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
8409fa90
Commit
8409fa90
authored
Feb 04, 2019
by
Varun Patil
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Reduce technical debt (1)
parent
3735fc4f
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
12 additions
and
105 deletions
+12
-105
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/fragment/AddEventFragment.java
app/src/main/java/app/insti/fragment/AddEventFragment.java
+2
-2
app/src/main/java/app/insti/fragment/MapFragment.java
app/src/main/java/app/insti/fragment/MapFragment.java
+3
-32
No files found.
app/src/main/java/app/insti/adapter/MessMenuAdapter.java
View file @
8409fa90
...
...
@@ -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 @
8409fa90
...
...
@@ -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 @
8409fa90
...
...
@@ -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 @
8409fa90
...
...
@@ -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/fragment/AddEventFragment.java
View file @
8409fa90
...
...
@@ -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/MapFragment.java
View file @
8409fa90
...
...
@@ -110,8 +110,6 @@ public class MapFragment extends Fragment implements TextWatcher,
public
static
final
int
SOUND_ID_RESULT
=
0
;
public
static
final
int
SOUND_ID_ADD
=
1
;
public
static
final
int
SOUND_ID_REMOVE
=
2
;
private
static
final
String
INSTANCE_CARD_STATE
=
"instanceCardState"
;
private
static
final
String
INSTANCE_VISIBILITY_INDEX
=
"instanceVisibilityIndex"
;
private
static
MapFragment
mainactivity
;
private
final
String
firstStackTag
=
"FIRST_TAG"
;
private
final
int
MSG_ANIMATE
=
1
;
...
...
@@ -137,10 +135,7 @@ public class MapFragment extends Fragment implements TextWatcher,
private
ListFragment
listFragment
;
private
Fragment
fragment
;
private
RelativeLayout
fragmentContainer
;
private
View
actionBarView
;
private
List
<
com
.
mrane
.
data
.
Marker
>
markerlist
;
private
DrawerLayout
mDrawerLayout
;
private
ActionBarDrawerToggle
mDrawerToggle
;
private
SlidingUpPanelLayout
slidingLayout
;
private
CardSlideListener
cardSlideListener
;
private
boolean
noFragments
=
true
;
...
...
@@ -363,22 +358,6 @@ public class MapFragment extends Fragment implements TextWatcher,
getActivity
().
findViewById
(
R
.
id
.
loadingPanel
).
setVisibility
(
View
.
GONE
);
}
@Override
public
void
onConfigurationChanged
(
Configuration
newConfig
)
{
// TODO Auto-generated method stub
super
.
onConfigurationChanged
(
newConfig
);
mDrawerToggle
.
onConfigurationChanged
(
newConfig
);
}
@Override
public
boolean
onOptionsItemSelected
(
MenuItem
item
)
{
// TODO Auto-generated method stub
if
(
mDrawerToggle
.
onOptionsItemSelected
(
item
))
{
return
true
;
}
return
super
.
onOptionsItemSelected
(
item
);
}
private
void
initShowDefault
()
{
String
[]
keys
=
{
"Convocation Hall"
,
"Hostel 13 House of Titans"
,
"Hostel 15"
,
"Main Gate no. 2"
,
...
...
@@ -426,12 +405,8 @@ public class MapFragment extends Fragment implements TextWatcher,
Runnable
runnable
=
new
Runnable
()
{
@Override
public
void
run
()
{
int
totalHeight
=
slidingLayout
.
getHeight
();
int
expandedCardHeight
=
getResources
().
getDimensionPixelSize
(
R
.
dimen
.
expanded_card_height
);
float
anchorPoint
=
0.5f
;
slidingLayout
.
setAnchorPoint
(
anchorPoint
);
Log
.
d
(
"testing"
,
"Anchor point = "
+
anchorPoint
);
}
};
...
...
@@ -703,12 +678,12 @@ public class MapFragment extends Fragment implements TextWatcher,
if
(
marker
instanceof
Room
)
{
Room
room
=
(
Room
)
marker
;
String
tag
=
room
.
tag
;
if
(!
tag
.
equals
(
"Inside"
))
{
if
(!
"Inside"
.
equals
(
tag
))
{
tag
+=
","
;
}
else
{
tag
=
"in"
;
}
com
.
mrane
.
data
.
Marker
parent
=
data
.
get
(
room
.
parentKey
);
Marker
parent
=
data
.
get
(
room
.
parentKey
);
final
String
parentKey
=
parent
.
getName
();
String
parentName
=
parent
.
getName
();
if
(!
parent
.
getShortName
().
equals
(
"0"
))
...
...
@@ -899,11 +874,7 @@ public class MapFragment extends Fragment implements TextWatcher,
private
boolean
handleRemoveIcon
()
{
String
text
=
editText
.
getText
().
toString
();
if
(
text
.
isEmpty
()
||
text
.
equals
(
null
))
{
return
false
;
}
else
{
return
true
;
}
return
!
text
.
isEmpty
();
}
@Override
...
...
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