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
3449c40a
Commit
3449c40a
authored
Feb 04, 2019
by
Varun Patil
Committed by
GitHub
Feb 04, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #270 from wncc/codacy
Reduce technical debt, fix some issues
parents
3735fc4f
c1756dfd
Changes
24
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
24 changed files
with
214 additions
and
384 deletions
+214
-384
app/src/main/java/app/insti/Constants.java
app/src/main/java/app/insti/Constants.java
+0
-1
app/src/main/java/app/insti/PeopleSuggestionAdapter.java
app/src/main/java/app/insti/PeopleSuggestionAdapter.java
+0
-98
app/src/main/java/app/insti/Utils.java
app/src/main/java/app/insti/Utils.java
+14
-6
app/src/main/java/app/insti/activity/MainActivity.java
app/src/main/java/app/insti/activity/MainActivity.java
+13
-16
app/src/main/java/app/insti/adapter/MessMenuAdapter.java
app/src/main/java/app/insti/adapter/MessMenuAdapter.java
+1
-1
app/src/main/java/app/insti/adapter/NewsAdapter.java
app/src/main/java/app/insti/adapter/NewsAdapter.java
+1
-2
app/src/main/java/app/insti/adapter/PlacementBlogAdapter.java
...src/main/java/app/insti/adapter/PlacementBlogAdapter.java
+1
-2
app/src/main/java/app/insti/api/ServiceGenerator.java
app/src/main/java/app/insti/api/ServiceGenerator.java
+4
-4
app/src/main/java/app/insti/api/UnsafeOkHttpClient.java
app/src/main/java/app/insti/api/UnsafeOkHttpClient.java
+0
-62
app/src/main/java/app/insti/api/model/User.java
app/src/main/java/app/insti/api/model/User.java
+1
-19
app/src/main/java/app/insti/fragment/AddEventFragment.java
app/src/main/java/app/insti/fragment/AddEventFragment.java
+2
-2
app/src/main/java/app/insti/fragment/BodyRecyclerViewFragment.java
...ain/java/app/insti/fragment/BodyRecyclerViewFragment.java
+1
-1
app/src/main/java/app/insti/fragment/CalendarFragment.java
app/src/main/java/app/insti/fragment/CalendarFragment.java
+2
-0
app/src/main/java/app/insti/fragment/ComplaintsFragment.java
app/src/main/java/app/insti/fragment/ComplaintsFragment.java
+1
-1
app/src/main/java/app/insti/fragment/EventFragment.java
app/src/main/java/app/insti/fragment/EventFragment.java
+11
-15
app/src/main/java/app/insti/fragment/ExploreFragment.java
app/src/main/java/app/insti/fragment/ExploreFragment.java
+1
-1
app/src/main/java/app/insti/fragment/FeedFragment.java
app/src/main/java/app/insti/fragment/FeedFragment.java
+1
-1
app/src/main/java/app/insti/fragment/FileComplaintFragment.java
...c/main/java/app/insti/fragment/FileComplaintFragment.java
+3
-3
app/src/main/java/app/insti/fragment/MapFragment.java
app/src/main/java/app/insti/fragment/MapFragment.java
+137
-116
app/src/main/java/app/insti/fragment/RoleRecyclerViewFragment.java
...ain/java/app/insti/fragment/RoleRecyclerViewFragment.java
+2
-5
app/src/main/java/app/insti/fragment/SettingsFragment.java
app/src/main/java/app/insti/fragment/SettingsFragment.java
+7
-13
app/src/main/java/app/insti/fragment/UserFragment.java
app/src/main/java/app/insti/fragment/UserFragment.java
+3
-0
app/src/main/java/com/mrane/campusmap/ListFragment.java
app/src/main/java/com/mrane/campusmap/ListFragment.java
+1
-3
app/src/main/java/com/mrane/zoomview/CampusMapView.java
app/src/main/java/com/mrane/zoomview/CampusMapView.java
+7
-12
No files found.
app/src/main/java/app/insti/Constants.java
View file @
3449c40a
...
...
@@ -2,7 +2,6 @@ package app.insti;
public
class
Constants
{
public
static
final
int
MY_PERMISSIONS_REQUEST_READ_EXTERNAL_STORAGE
=
1
;
public
static
final
int
MY_PERMISSIONS_REQUEST_ACCESS_LOCATION
=
2
;
public
static
final
int
MY_PERMISSIONS_REQUEST_LOCATION
=
3
;
public
static
final
int
RESULT_LOAD_IMAGE
=
11
;
public
static
final
int
REQUEST_CAMERA_INT_ID
=
101
;
...
...
app/src/main/java/app/insti/PeopleSuggestionAdapter.java
deleted
100644 → 0
View file @
3735fc4f
package
app.insti
;
import
android.content.Context
;
import
android.view.LayoutInflater
;
import
android.view.View
;
import
android.view.ViewGroup
;
import
android.widget.BaseAdapter
;
import
android.widget.Filter
;
import
android.widget.Filterable
;
import
android.widget.TextView
;
import
java.util.ArrayList
;
import
java.util.List
;
/**
* Created by mrunz on 6/7/17.
*/
public
class
PeopleSuggestionAdapter
extends
BaseAdapter
implements
Filterable
{
List
mData
;
List
mStringFilterList
;
ValueFilter
valueFilter
;
private
LayoutInflater
inflater
;
public
PeopleSuggestionAdapter
(
List
cancel_type
)
{
mData
=
cancel_type
;
mStringFilterList
=
cancel_type
;
}
@Override
public
int
getCount
()
{
return
mData
.
size
();
}
@Override
public
Object
getItem
(
int
position
)
{
return
mData
.
get
(
position
);
}
@Override
public
long
getItemId
(
int
position
)
{
return
position
;
}
@Override
public
View
getView
(
int
position
,
View
convertView
,
final
ViewGroup
parent
)
{
if
(
inflater
==
null
)
{
inflater
=
(
LayoutInflater
)
parent
.
getContext
()
.
getSystemService
(
Context
.
LAYOUT_INFLATER_SERVICE
);
}
View
view
=
inflater
.
inflate
(
R
.
layout
.
ppl_search_suggestion_item_view
,
parent
,
false
);
TextView
tv_suggestion
=
(
TextView
)
view
.
findViewById
(
R
.
id
.
suggestion_item
);
tv_suggestion
.
setText
(
mData
.
get
(
position
).
toString
());
return
view
;
}
@Override
public
Filter
getFilter
()
{
if
(
valueFilter
==
null
)
{
valueFilter
=
new
ValueFilter
();
}
return
valueFilter
;
}
private
class
ValueFilter
extends
Filter
{
@Override
protected
FilterResults
performFiltering
(
CharSequence
constraint
)
{
FilterResults
results
=
new
FilterResults
();
if
(
constraint
!=
null
&&
constraint
.
length
()
>
0
)
{
List
filterList
=
new
ArrayList
();
for
(
int
i
=
0
;
i
<
mStringFilterList
.
size
();
i
++)
{
if
((
mStringFilterList
.
get
(
i
).
toString
().
toUpperCase
()).
contains
(
constraint
.
toString
().
toUpperCase
()))
{
filterList
.
add
(
mStringFilterList
.
get
(
i
));
}
}
results
.
count
=
filterList
.
size
();
results
.
values
=
filterList
;
}
else
{
results
.
count
=
mStringFilterList
.
size
();
results
.
values
=
mStringFilterList
;
}
return
results
;
}
@Override
protected
void
publishResults
(
CharSequence
constraint
,
FilterResults
results
)
{
mData
=
(
List
)
results
.
values
;
notifyDataSetChanged
();
}
}
}
\ No newline at end of file
app/src/main/java/app/insti/Utils.java
View file @
3449c40a
...
...
@@ -88,8 +88,8 @@ public final class Utils {
public
static
final
void
updateFragment
(
Fragment
fragment
,
FragmentActivity
fragmentActivity
)
{
FragmentTransaction
ft
=
fragmentActivity
.
getSupportFragmentManager
().
beginTransaction
();
ft
.
setCustomAnimations
(
R
.
anim
.
slide_in_up
,
R
.
anim
.
fade_out
,
R
.
anim
.
fade_in
,
R
.
anim
.
slide_out_down
);
ft
.
replace
(
R
.
id
.
framelayout_for_fragment
,
fragment
,
fragment
.
getTag
(
));
ft
.
addToBackStack
(
fragment
.
getTag
(
));
ft
.
replace
(
R
.
id
.
framelayout_for_fragment
,
fragment
,
getTag
(
fragment
));
ft
.
addToBackStack
(
getTag
(
fragment
));
ft
.
commit
();
}
...
...
@@ -141,8 +141,8 @@ public final class Utils {
}
/* Update the fragment */
ft
.
replace
(
R
.
id
.
framelayout_for_fragment
,
fragment
,
fragment
.
getTag
(
))
.
addToBackStack
(
fragment
.
getTag
(
))
ft
.
replace
(
R
.
id
.
framelayout_for_fragment
,
fragment
,
getTag
(
fragment
))
.
addToBackStack
(
getTag
(
fragment
))
.
commit
();
}
...
...
@@ -247,8 +247,8 @@ public final class Utils {
FragmentManager
fm
=
fragmentActivity
.
getSupportFragmentManager
();
fm
.
popBackStack
();
FragmentTransaction
ft
=
fm
.
beginTransaction
();
ft
.
addToBackStack
(
newFragment
.
getTag
(
));
ft
.
replace
(
R
.
id
.
framelayout_for_fragment
,
newFragment
,
newFragment
.
getTag
(
)).
commit
();
ft
.
addToBackStack
(
getTag
(
fragment
));
ft
.
replace
(
R
.
id
.
framelayout_for_fragment
,
newFragment
,
getTag
(
fragment
)).
commit
();
}
public
static
void
setSelectedMenuItem
(
Activity
activity
,
int
id
)
{
...
...
@@ -286,4 +286,12 @@ public final class Utils {
CookieManager
.
getInstance
().
removeAllCookies
(
null
);
CookieManager
.
getInstance
().
flush
();
}
public
static
String
getTag
(
Fragment
fragment
)
{
String
TAG
=
fragment
.
getTag
();
try
{
TAG
=
(
String
)
fragment
.
getClass
().
getField
(
"TAG"
).
get
(
fragment
);
}
catch
(
NoSuchFieldException
|
IllegalAccessException
ignored
)
{}
return
TAG
;
}
}
app/src/main/java/app/insti/activity/MainActivity.java
View file @
3449c40a
...
...
@@ -85,7 +85,6 @@ 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
.
FCM_BUNDLE_NOTIFICATION_ID
;
import
static
app
.
insti
.
Constants
.
MY_PERMISSIONS_REQUEST_ACCESS_LOCATION
;
import
static
app
.
insti
.
Constants
.
MY_PERMISSIONS_REQUEST_LOCATION
;
import
static
app
.
insti
.
Constants
.
MY_PERMISSIONS_REQUEST_READ_EXTERNAL_STORAGE
;
import
static
app
.
insti
.
Constants
.
RESULT_LOAD_IMAGE
;
...
...
@@ -616,7 +615,6 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
* Change the active fragment to the supplied one
*/
public
void
updateFragment
(
Fragment
fragment
)
{
Log
.
d
(
TAG
,
"updateFragment: "
+
fragment
.
toString
());
Bundle
bundle
=
fragment
.
getArguments
();
if
(
bundle
==
null
)
{
bundle
=
new
Bundle
();
...
...
@@ -642,8 +640,8 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
transaction
.
setCustomAnimations
(
R
.
anim
.
slide_in_up
,
R
.
anim
.
fade_out
,
R
.
anim
.
fade_in
,
R
.
anim
.
slide_out_down
);
}
transaction
.
replace
(
R
.
id
.
framelayout_for_fragment
,
fragment
,
fragment
.
getTag
(
));
transaction
.
addToBackStack
(
fragment
.
getTag
(
)).
commit
();
transaction
.
replace
(
R
.
id
.
framelayout_for_fragment
,
fragment
,
Utils
.
getTag
(
fragment
));
transaction
.
addToBackStack
(
Utils
.
getTag
(
fragment
)).
commit
();
}
public
void
onRequestPermissionsResult
(
int
requestCode
,
String
[]
permissions
,
int
[]
grantResults
)
{
...
...
@@ -655,21 +653,20 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
startActivityForResult
(
i
,
RESULT_LOAD_IMAGE
);
}
return
;
case
MY_PERMISSIONS_REQUEST_ACCESS_LOCATION:
if
(
grantResults
.
length
>
0
&&
grantResults
[
0
]
==
PackageManager
.
PERMISSION_GRANTED
)
{
MapFragment
.
getMainActivity
().
setupGPS
();
}
else
{
Toast
toast
=
Toast
.
makeText
(
MainActivity
.
this
,
"Need Permission"
,
Toast
.
LENGTH_SHORT
);
toast
.
show
();
}
break
;
case
MY_PERMISSIONS_REQUEST_LOCATION:
Log
.
i
(
TAG
,
"Permission request captured"
);
if
(
grantResults
.
length
>
0
&&
grantResults
[
0
]
==
PackageManager
.
PERMISSION_GRANTED
)
{
Log
.
i
(
TAG
,
"Permission Granted"
);
// Map
MapFragment
mapFragment
=
(
MapFragment
)
getSupportFragmentManager
().
findFragmentByTag
(
MapFragment
.
TAG
);
if
(
mapFragment
!=
null
&&
mapFragment
.
isVisible
())
{
MapFragment
.
getMainActivity
().
setupGPS
(
true
);
}
// File complaint
FileComplaintFragment
fileComplaintFragment
=
(
FileComplaintFragment
)
getSupportFragmentManager
().
findFragmentByTag
(
FileComplaintFragment
.
TAG
);
if
(
fileComplaintFragment
!=
null
&&
fileComplaintFragment
.
isVisible
())
{
FileComplaintFragment
.
getMainActivity
().
getMapReady
();
}
}
else
{
Log
.
i
(
TAG
,
"Permission Cancelled"
);
Toast
toast
=
Toast
.
makeText
(
MainActivity
.
this
,
"Need Permission"
,
Toast
.
LENGTH_SHORT
);
toast
.
show
();
}
...
...
app/src/main/java/app/insti/adapter/MessMenuAdapter.java
View file @
3449c40a
...
...
@@ -74,7 +74,7 @@ public class MessMenuAdapter extends RecyclerView.Adapter<MessMenuAdapter.ViewHo
case
7
:
return
"Sunday"
;
default
:
throw
new
Runtime
Exception
(
"DayIndexOutOfBounds: "
+
day
);
throw
new
IndexOutOfBounds
Exception
(
"DayIndexOutOfBounds: "
+
day
);
}
}
...
...
app/src/main/java/app/insti/adapter/NewsAdapter.java
View file @
3449c40a
...
...
@@ -29,7 +29,6 @@ public class NewsAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> i
private
final
int
VIEW_PROG
=
0
;
private
List
<
NewsArticle
>
newsArticles
;
private
Context
context
;
private
ItemClickListener
itemClickListener
;
public
NewsAdapter
(
List
<
NewsArticle
>
newsArticles
,
ItemClickListener
itemClickListener
)
{
...
...
@@ -51,7 +50,7 @@ public class NewsAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> i
@NonNull
@Override
public
RecyclerView
.
ViewHolder
onCreateViewHolder
(
@NonNull
ViewGroup
parent
,
int
viewType
)
{
context
=
parent
.
getContext
();
final
Context
context
=
parent
.
getContext
();
if
(
viewType
==
VIEW_ITEM
)
{
LayoutInflater
inflater
=
LayoutInflater
.
from
(
context
);
View
postView
=
inflater
.
inflate
(
R
.
layout
.
news_article_card
,
parent
,
false
);
...
...
app/src/main/java/app/insti/adapter/PlacementBlogAdapter.java
View file @
3449c40a
...
...
@@ -27,7 +27,6 @@ public class PlacementBlogAdapter extends RecyclerView.Adapter<RecyclerView.View
private
final
int
VIEW_ITEM
=
1
;
private
final
int
VIEW_PROG
=
0
;
private
List
<
PlacementBlogPost
>
posts
;
private
Context
context
;
private
ItemClickListener
itemClickListener
;
public
PlacementBlogAdapter
(
List
<
PlacementBlogPost
>
posts
,
ItemClickListener
itemClickListener
)
{
this
.
posts
=
posts
;
...
...
@@ -45,7 +44,7 @@ public class PlacementBlogAdapter extends RecyclerView.Adapter<RecyclerView.View
@Override
public
RecyclerView
.
ViewHolder
onCreateViewHolder
(
ViewGroup
parent
,
int
viewType
)
{
context
=
parent
.
getContext
();
final
Context
context
=
parent
.
getContext
();
if
(
viewType
==
VIEW_ITEM
)
{
LayoutInflater
inflater
=
LayoutInflater
.
from
(
context
);
View
postView
=
inflater
.
inflate
(
R
.
layout
.
blog_post_card
,
parent
,
false
);
...
...
app/src/main/java/app/insti/api/ServiceGenerator.java
View file @
3449c40a
...
...
@@ -18,9 +18,10 @@ import retrofit2.Retrofit;
import
retrofit2.converter.gson.GsonConverterFactory
;
public
class
ServiceGenerator
{
p
ublic
static
final
String
HEADER_CACHE_CONTROL
=
"Cache-Control"
;
p
ublic
static
final
String
HEADER_PRAGMA
=
"Pragma"
;
p
rivate
static
final
String
HEADER_CACHE_CONTROL
=
"Cache-Control"
;
p
rivate
static
final
String
HEADER_PRAGMA
=
"Pragma"
;
private
static
final
String
BASE_URL
=
"https://api.insti.app/api/"
;
public
RetrofitInterface
retrofitInterface
;
private
Context
context
;
...
...
@@ -99,10 +100,9 @@ public class ServiceGenerator {
.
baseUrl
(
BASE_URL
)
.
addConverterFactory
(
GsonConverterFactory
.
create
());
private
Retrofit
retrofit
;
public
RetrofitInterface
retrofitInterface
;
public
ServiceGenerator
(
Context
mContext
)
{
context
=
mContext
;
final
Retrofit
retrofit
;
retrofit
=
retrofitBuilder
.
client
(
clientBuilder
.
addInterceptor
(
provideOfflineCacheInterceptor
)
...
...
app/src/main/java/app/insti/api/UnsafeOkHttpClient.java
deleted
100644 → 0
View file @
3735fc4f
package
app.insti.api
;
import
android.content.Context
;
import
java.security.cert.CertificateException
;
import
javax.net.ssl.HostnameVerifier
;
import
javax.net.ssl.SSLContext
;
import
javax.net.ssl.SSLSession
;
import
javax.net.ssl.SSLSocketFactory
;
import
javax.net.ssl.TrustManager
;
import
javax.net.ssl.X509TrustManager
;
import
okhttp3.Cache
;
import
okhttp3.OkHttpClient
;
public
class
UnsafeOkHttpClient
{
public
static
OkHttpClient
getUnsafeOkHttpClient
(
Context
context
)
{
try
{
// Create a trust manager that does not validate certificate chains
final
TrustManager
[]
trustAllCerts
=
new
TrustManager
[]{
new
X509TrustManager
()
{
@Override
public
void
checkClientTrusted
(
java
.
security
.
cert
.
X509Certificate
[]
chain
,
String
authType
)
throws
CertificateException
{
}
@Override
public
void
checkServerTrusted
(
java
.
security
.
cert
.
X509Certificate
[]
chain
,
String
authType
)
throws
CertificateException
{
}
@Override
public
java
.
security
.
cert
.
X509Certificate
[]
getAcceptedIssuers
()
{
return
new
java
.
security
.
cert
.
X509Certificate
[]{};
}
}
};
// Install the all-trusting trust manager
final
SSLContext
sslContext
=
SSLContext
.
getInstance
(
"SSL"
);
sslContext
.
init
(
null
,
trustAllCerts
,
new
java
.
security
.
SecureRandom
());
// Create an ssl socket factory with our all-trusting manager
final
SSLSocketFactory
sslSocketFactory
=
sslContext
.
getSocketFactory
();
OkHttpClient
.
Builder
builder
=
new
OkHttpClient
.
Builder
();
Cache
cache
=
new
Cache
(
context
.
getCacheDir
(),
200000000
);
builder
.
cache
(
cache
);
builder
.
sslSocketFactory
(
sslSocketFactory
,
(
X509TrustManager
)
trustAllCerts
[
0
]);
builder
.
hostnameVerifier
(
new
HostnameVerifier
()
{
@Override
public
boolean
verify
(
String
hostname
,
SSLSession
session
)
{
return
true
;
}
});
OkHttpClient
okHttpClient
=
builder
.
build
();
return
okHttpClient
;
}
catch
(
Exception
e
)
{
throw
new
RuntimeException
(
e
);
}
}
}
app/src/main/java/app/insti/api/model/User.java
View file @
3449c40a
...
...
@@ -67,26 +67,8 @@ public class User implements CardInterface {
private
String
currentRole
;
public
User
(
@NonNull
String
userID
,
String
userName
,
String
userProfilePictureUrl
,
List
<
Event
>
userInterestedEvents
,
List
<
Event
>
userGoingEvents
,
String
userEmail
,
String
userRollNumber
,
String
userContactNumber
,
Boolean
showContactNumber
,
String
userAbout
,
List
<
Body
>
userFollowedBodies
,
List
<
String
>
userFollowedBodiesID
,
List
<
Role
>
userRoles
,
List
<
Role
>
userInstituteRoles
,
List
<
Role
>
userFormerRoles
,
String
userWebsiteURL
,
String
userLDAPId
,
String
hostel
,
String
currentRole
)
{
public
User
(
@NonNull
String
userID
)
{
this
.
userID
=
userID
;
this
.
userName
=
userName
;
this
.
userProfilePictureUrl
=
userProfilePictureUrl
;
this
.
userInterestedEvents
=
userInterestedEvents
;
this
.
userGoingEvents
=
userGoingEvents
;
this
.
userEmail
=
userEmail
;
this
.
userRollNumber
=
userRollNumber
;
this
.
userContactNumber
=
userContactNumber
;
this
.
showContactNumber
=
showContactNumber
;
this
.
userAbout
=
userAbout
;
this
.
userFollowedBodies
=
userFollowedBodies
;
this
.
userFollowedBodiesID
=
userFollowedBodiesID
;
this
.
userRoles
=
userRoles
;
this
.
userInstituteRoles
=
userInstituteRoles
;
this
.
userFormerRoles
=
userFormerRoles
;
this
.
userWebsiteURL
=
userWebsiteURL
;
this
.
userLDAPId
=
userLDAPId
;
this
.
hostel
=
hostel
;
this
.
currentRole
=
currentRole
;
}
public
static
User
fromString
(
String
json
)
{
...
...
app/src/main/java/app/insti/fragment/AddEventFragment.java
View file @
3449c40a
...
...
@@ -136,7 +136,7 @@ public class AddEventFragment extends BaseFragment {
return
view
;
}
void
openEvent
(
Event
event
)
{
private
void
openEvent
(
Event
event
)
{
String
eventJson
=
new
Gson
().
toJson
(
event
);
Bundle
bundle
=
getArguments
();
if
(
bundle
==
null
)
...
...
@@ -151,7 +151,7 @@ public class AddEventFragment extends BaseFragment {
transaction
.
addToBackStack
(
eventFragment
.
getTag
()).
commit
();
}
void
openBody
(
Body
body
)
{
private
void
openBody
(
Body
body
)
{
BodyFragment
bodyFragment
=
BodyFragment
.
newInstance
(
body
);
FragmentManager
manager
=
getActivity
().
getSupportFragmentManager
();
FragmentTransaction
transaction
=
manager
.
beginTransaction
();
...
...
app/src/main/java/app/insti/fragment/BodyRecyclerViewFragment.java
View file @
3449c40a
...
...
@@ -27,7 +27,7 @@ import app.insti.api.model.Body;
* create an instance of this fragment.
*/
public
class
BodyRecyclerViewFragment
extends
Fragment
implements
TransitionTargetFragment
,
TransitionTargetChild
{
p
rivate
static
final
String
TAG
=
"BodyRecyclerViewFragment"
;
p
ublic
static
final
String
TAG
=
"BodyRecyclerViewFragment"
;
public
Fragment
parentFragment
=
null
;
private
RecyclerView
recyclerView
;
...
...
app/src/main/java/app/insti/fragment/CalendarFragment.java
View file @
3449c40a
...
...
@@ -230,6 +230,8 @@ public class CalendarFragment extends BaseFragment {
@Override
public
void
onResponse
(
Call
<
NewsFeedResponse
>
call
,
Response
<
NewsFeedResponse
>
response
)
{
if
(
response
.
isSuccessful
())
{
if
(
getActivity
()
==
null
||
getView
()
==
null
)
return
;
// Concatenate the response
NewsFeedResponse
newsFeedResponse
=
response
.
body
();
List
<
Event
>
eventList
=
newsFeedResponse
.
getEvents
();
...
...
app/src/main/java/app/insti/fragment/ComplaintsFragment.java
View file @
3449c40a
...
...
@@ -51,7 +51,7 @@ public class ComplaintsFragment extends BaseFragment {
FileComplaintFragment
fileComplaintFragment
=
new
FileComplaintFragment
();
fileComplaintFragment
.
setArguments
(
getArguments
());
FragmentTransaction
fragmentTransaction
=
getFragmentManager
().
beginTransaction
();
fragmentTransaction
.
replace
(
R
.
id
.
framelayout_for_fragment
,
fileComplaintFragment
,
fileComplaintFragment
.
getTag
(
));
fragmentTransaction
.
replace
(
R
.
id
.
framelayout_for_fragment
,
fileComplaintFragment
,
Utils
.
getTag
(
fileComplaintFragment
));
fragmentTransaction
.
addToBackStack
(
"Complaint Fragment"
).
commit
();
}
});
...
...
app/src/main/java/app/insti/fragment/EventFragment.java
View file @
3449c40a
...
...
@@ -65,14 +65,10 @@ import ru.noties.markwon.Markwon;
* A simple {@link Fragment} subclass.
*/
public
class
EventFragment
extends
BackHandledFragment
implements
TransitionTargetFragment
{
Event
event
;
Button
goingButton
;
Button
interestedButton
;
ImageButton
navigateButton
;
ImageButton
webEventButton
;
ImageButton
shareEventButton
;
RecyclerView
bodyRecyclerView
;
String
TAG
=
"EventFragment"
;
private
Event
event
;
private
Button
goingButton
;
private
Button
interestedButton
;
public
String
TAG
=
"EventFragment"
;
private
int
appBarOffset
=
0
;
private
boolean
creatingView
=
false
;
...
...
@@ -198,14 +194,14 @@ public class EventFragment extends BackHandledFragment implements TransitionTarg
private
void
inflateViews
(
final
Event
event
)
{
eventPicture
=
(
ImageView
)
getActivity
().
findViewById
(
R
.
id
.
event_picture_2
);
TextView
eventTitle
=
(
TextView
)
getActivity
().
findViewById
(
R
.
id
.
event_page_title
);
TextView
eventDate
=
(
TextView
)
getActivity
().
findViewById
(
R
.
id
.
event_page_date
);
TextView
eventDescription
=
(
TextView
)
getActivity
().
findViewById
(
R
.
id
.
event_page_description
);
final
TextView
eventTitle
=
(
TextView
)
getActivity
().
findViewById
(
R
.
id
.
event_page_title
);
final
TextView
eventDate
=
(
TextView
)
getActivity
().
findViewById
(
R
.
id
.
event_page_date
);
final
TextView
eventDescription
=
(
TextView
)
getActivity
().
findViewById
(
R
.
id
.
event_page_description
);
goingButton
=
getActivity
().
findViewById
(
R
.
id
.
going_button
);
interestedButton
=
getActivity
().
findViewById
(
R
.
id
.
interested_button
);
navigateButton
=
getActivity
().
findViewById
(
R
.
id
.
navigate_button
);
webEventButton
=
getActivity
().
findViewById
(
R
.
id
.
web_event_button
);
shareEventButton
=
getActivity
().
findViewById
(
R
.
id
.
share_event_button
);
final
ImageButton
navigateButton
=
getActivity
().
findViewById
(
R
.
id
.
navigate_button
);
final
ImageButton
webEventButton
=
getActivity
().
findViewById
(
R
.
id
.
web_event_button
);
final
ImageButton
shareEventButton
=
getActivity
().
findViewById
(
R
.
id
.
share_event_button
);
if
(
event
.
isEventBigImage
()
||
!
creatingView
)
{
Picasso
.
get
().
load
(
event
.
getEventImageURL
()).
into
(
eventPicture
);
...
...
@@ -221,7 +217,7 @@ public class EventFragment extends BackHandledFragment implements TransitionTarg
SimpleDateFormat
simpleDateFormatTime
=
new
SimpleDateFormat
(
"HH:mm"
);
final
List
<
Body
>
bodyList
=
event
.
getEventBodies
();
bodyRecyclerView
=
(
RecyclerView
)
getActivity
().
findViewById
(
R
.
id
.
body_card_recycler_view
);
final
RecyclerView
bodyRecyclerView
=
getActivity
().
findViewById
(
R
.
id
.
body_card_recycler_view
);
BodyAdapter
bodyAdapter
=
new
BodyAdapter
(
bodyList
,
this
);
bodyRecyclerView
.
setAdapter
(
bodyAdapter
);
bodyRecyclerView
.
setLayoutManager
(
new
LinearLayoutManager
(
getContext
()));
...
...
app/src/main/java/app/insti/fragment/ExploreFragment.java
View file @
3449c40a
...
...
@@ -41,7 +41,7 @@ import retrofit2.Response;
public
class
ExploreFragment
extends
Fragment
{
private
RecyclerView
recyclerView
;
LinearLayoutManager
mLayoutManager
;
private
LinearLayoutManager
mLayoutManager
;
private
static
List
<
Body
>
allBodies
=
new
ArrayList
<>();
private
static
List
<
Body
>
bodies
=
new
ArrayList
<>();
...
...
app/src/main/java/app/insti/fragment/FeedFragment.java
View file @
3449c40a
...
...
@@ -35,7 +35,7 @@ public class FeedFragment extends BaseFragment {
private
RecyclerView
feedRecyclerView
;
private
SwipeRefreshLayout
feedSwipeRefreshLayout
;
private
FloatingActionButton
fab
;
LinearLayoutManager
mLayoutManager
;
private
LinearLayoutManager
mLayoutManager
;
private
int
index
=
-
1
,
top
=
-
1
;
private
FeedAdapter
feedAdapter
=
null
;
...
...
app/src/main/java/app/insti/fragment/FileComplaintFragment.java
View file @
3449c40a
...
...
@@ -69,10 +69,10 @@ import java.io.ByteArrayOutputStream;
import
java.util.ArrayList
;
import
java.util.List
;
import
app.insti.Constants
;
import
app.insti.ComplaintDescriptionAutoCompleteTextView
;
import
app.insti.R
;
import
app.insti.ComplaintTag
;
import
app.insti.Constants
;
import
app.insti.R
;
import
app.insti.Utils
;
import
app.insti.activity.MainActivity
;
import
app.insti.adapter.ImageViewPagerAdapter
;
...
...
@@ -95,7 +95,7 @@ import static app.insti.Constants.RESULT_LOAD_IMAGE;
public
class
FileComplaintFragment
extends
Fragment
{
p
rivate
static
final
String
TAG
=
FileComplaintFragment
.
class
.
getSimpleName
();
p
ublic
static
final
String
TAG
=
FileComplaintFragment
.
class
.
getSimpleName
();
private
static
FileComplaintFragment
mainactivity
;
private
Button
buttonSubmit
;
private
ComplaintDescriptionAutoCompleteTextView
descriptionAutoCompleteTextview
;
...
...
app/src/main/java/app/insti/fragment/MapFragment.java
View file @
3449c40a
This diff is collapsed.
Click to expand it.
app/src/main/java/app/insti/fragment/RoleRecyclerViewFragment.java
View file @
3449c40a
...
...
@@ -27,9 +27,6 @@ public class RoleRecyclerViewFragment extends Fragment implements TransitionTarg
private
static
final
String
TAG
=
"RoleRecyclerViewFragment"
;
public
Fragment
parentFragment
=
null
;
private
RecyclerView
recyclerView
;
private
RoleAdapter
roleAdapter
;
private
List
<
Role
>
roleList
;
public
RoleRecyclerViewFragment
()
{
...
...
@@ -70,8 +67,8 @@ public class RoleRecyclerViewFragment extends Fragment implements TransitionTarg
public
void
onStart
()
{
super
.
onStart
();
recyclerView
=
(
RecyclerView
)
getActivity
().
findViewById
(
R
.
id
.
role_recycler_view
);
roleAdapter
=
new
RoleAdapter
(
roleList
,
this
);
RecyclerView
recyclerView
=
(
RecyclerView
)
getActivity
().
findViewById
(
R
.
id
.
role_recycler_view
);
RoleAdapter
roleAdapter
=
new
RoleAdapter
(
roleList
,
this
);
roleAdapter
.
uid
=
"RRVFrag"
;
recyclerView
.
setAdapter
(
roleAdapter
);
recyclerView
.
setLayoutManager
(
new
LinearLayoutManager
(
getContext
()));
...
...
app/src/main/java/app/insti/fragment/SettingsFragment.java
View file @
3449c40a
...
...
@@ -24,21 +24,15 @@ import retrofit2.Callback;
import
retrofit2.Response
;
public
class
SettingsFragment
extends
PreferenceFragmentCompat
{
private
SwitchPreferenceCompat
showContactPref
;
private
SwitchPreferenceCompat
darkThemePref
;
private
Preference
profilePref
;
private
Preference
feedbackPref
;
private
Preference
aboutPref
;
private
Preference
logoutPref
;
private
SharedPreferences
sharedPref
;
private
SharedPreferences
.
Editor
editor
;
private
SwitchPreferenceCompat
showContactPref
;
@Override
public
void
onCreatePreferences
(
Bundle
savedInstanceState
,
String
rootKey
)
{
setPreferencesFromResource
(
R
.
xml
.
preferences
,
rootKey
);
// Get preferences and editor
sharedPref
=
getActivity
().
getSharedPreferences
(
Constants
.
PREF_NAME
,
Context
.
MODE_PRIVATE
);
SharedPreferences
sharedPref
=
getActivity
().
getSharedPreferences
(
Constants
.
PREF_NAME
,
Context
.
MODE_PRIVATE
);
editor
=
sharedPref
.
edit
();
// Show contact number
...
...
@@ -53,7 +47,7 @@ public class SettingsFragment extends PreferenceFragmentCompat {
showContactPref
.
setEnabled
(
false
);
// Dark Theme
darkThemePref
=
(
SwitchPreferenceCompat
)
findPreference
(
"dark_theme"
);
SwitchPreferenceCompat
darkThemePref
=
(
SwitchPreferenceCompat
)
findPreference
(
"dark_theme"
);
darkThemePref
.
setOnPreferenceChangeListener
(
new
Preference
.
OnPreferenceChangeListener
()
{
@Override
public
boolean
onPreferenceChange
(
Preference
preference
,
Object
o
)
{
...
...
@@ -64,7 +58,7 @@ public class SettingsFragment extends PreferenceFragmentCompat {
darkThemePref
.
setChecked
(
sharedPref
.
getBoolean
(
Constants
.
DARK_THEME
,
false
));
// Update Profile
profilePref
=
findPreference
(
"profile"
);
Preference
profilePref
=
findPreference
(
"profile"
);
profilePref
.
setOnPreferenceClickListener
(
new
Preference
.
OnPreferenceClickListener
()
{
@Override
public
boolean
onPreferenceClick
(
Preference
preference
)
{
...
...
@@ -74,7 +68,7 @@ public class SettingsFragment extends PreferenceFragmentCompat {
});
// Feedback
feedbackPref
=
findPreference
(
"feedback"
);
Preference
feedbackPref
=
findPreference
(
"feedback"
);
feedbackPref
.
setOnPreferenceClickListener
(
new
Preference
.
OnPreferenceClickListener
()
{
@Override
public
boolean
onPreferenceClick
(
Preference
preference
)
{
...
...
@@ -84,7 +78,7 @@ public class SettingsFragment extends PreferenceFragmentCompat {
});
// About
aboutPref
=
findPreference
(
"about"
);
Preference
aboutPref
=
findPreference
(
"about"
);
aboutPref
.
setOnPreferenceClickListener
(
new
Preference
.
OnPreferenceClickListener
()
{
@Override
public
boolean
onPreferenceClick
(
Preference
preference
)
{
...
...
@@ -94,7 +88,7 @@ public class SettingsFragment extends PreferenceFragmentCompat {
});
// Logout
logoutPref
=
findPreference
(
"logout"
);
Preference
logoutPref
=
findPreference
(
"logout"
);
logoutPref
.
setOnPreferenceClickListener
(
new
Preference
.
OnPreferenceClickListener
()
{
@Override
public
boolean
onPreferenceClick
(
Preference
preference
)
{
...
...
app/src/main/java/app/insti/fragment/UserFragment.java
View file @
3449c40a
...
...
@@ -116,6 +116,7 @@ public class UserFragment extends BackHandledFragment implements TransitionTarge
@Override
public
void
onResponse
(
Call
<
User
>
call
,
Response
<
User
>
response
)
{
if
(
response
.
isSuccessful
())
{
if
(
getActivity
()
==
null
||
getView
()
==
null
)
return
;
user
=
response
.
body
();
populateViews
();
getActivity
().
findViewById
(
R
.
id
.
loadingPanel
).
setVisibility
(
View
.
GONE
);
...
...
@@ -145,6 +146,8 @@ public class UserFragment extends BackHandledFragment implements TransitionTarge
}
private
void
populateViews
()
{
if
(
getActivity
()
==
null
||
getView
()
==
null
)
return
;
userProfilePictureImageView
=
getActivity
().
findViewById
(
R
.
id
.
user_profile_picture_profile
);
TextView
userNameTextView
=
getActivity
().
findViewById
(
R
.
id
.
user_name_profile
);
TextView
userRollNumberTextView
=
getActivity
().
findViewById
(
R
.
id
.
user_rollno_profile
);
...
...
app/src/main/java/com/mrane/campusmap/ListFragment.java
View file @
3449c40a
...
...
@@ -17,8 +17,6 @@ import app.insti.fragment.MapFragment;
public
class
ListFragment
extends
Fragment
{
MapFragment
mainActivity
;
FuzzySearchAdapter
adapter
;
HashMap
<
String
,
Marker
>
data
;
View
rootView
;
ListView
list
;
...
...
@@ -29,7 +27,7 @@ public class ListFragment extends Fragment {
public
View
onCreateView
(
LayoutInflater
inflater
,
ViewGroup
container
,
Bundle
savedInstanceState
)
{
mainActivity
=
MapFragment
.
getMainActivity
();
adapter
=
mainActivity
.
getAdapter
();
final
FuzzySearchAdapter
adapter
=
mainActivity
.
getAdapter
();
rootView
=
inflater
.
inflate
(
R
.
layout
.
map_list_fragment
,
container
,
false
);
list
=
(
ListView
)
rootView
.
findViewById
(
R
.
id
.
suggestion_list
);
list
.
setAdapter
(
adapter
);
...
...
app/src/main/java/com/mrane/zoomview/CampusMapView.java
View file @
3449c40a
...
...
@@ -412,22 +412,19 @@ public class CampusMapView extends SubsamplingScaleImageView {
for
(
Marker
marker
:
markerList
)
{
if
(
isInView
(
marker
.
getPoint
()))
{
if
(
isShowPinScale
(
marker
)
&&
!(
isResultMarker
(
marker
)
||
addedMarkerList
.
contains
(
marker
)))
{
if
(
shouldShowUp
(
marker
))
if
(
isShowPinScale
(
marker
)
&&
!(
isResultMarker
(
marker
)
||
addedMarkerList
.
contains
(
marker
))
&&
shouldShowUp
(
marker
))
{
drawPionterAndText
(
canvas
,
marker
);
}
}
}
for
(
Marker
marker
:
addedMarkerList
)
{
if
(
isInView
(
marker
.
getPoint
()))
{
if
(!
isResultMarker
(
marker
))
{
if
(
isInView
(
marker
.
getPoint
())
&&
!
isResultMarker
(
marker
))
{
drawMarkerBitmap
(
canvas
,
marker
);
drawMarkerText
(
canvas
,
marker
);
}
}
}
Marker
marker
=
getResultMarker
();
if
(
marker
!=
null
)
{
if
(
isInView
(
marker
.
getPoint
()))
{
...
...
@@ -689,8 +686,6 @@ public class CampusMapView extends SubsamplingScaleImageView {
if
(
motionEvent
.
getX
()
<
20
*
density
)
{
getParent
().
requestDisallowInterceptTouchEvent
(
false
);
return
true
;
}
else
{
// CampusMapView.this.setPanEnabled(true);
}
}
else
if
(
action
==
MotionEvent
.
ACTION_UP
)
{
CampusMapView
.
this
.
setPanEnabled
(
true
);
...
...
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