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
450acba0
Commit
450acba0
authored
Sep 26, 2018
by
Varun Patil
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'patch15' into noroom
parents
231aeda1
2a3900d4
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
26 additions
and
6 deletions
+26
-6
app/src/main/java/app/insti/Constants.java
app/src/main/java/app/insti/Constants.java
+4
-0
app/src/main/java/app/insti/activity/MainActivity.java
app/src/main/java/app/insti/activity/MainActivity.java
+14
-4
app/src/main/java/app/insti/adapter/BodyAdapter.java
app/src/main/java/app/insti/adapter/BodyAdapter.java
+4
-1
app/src/main/java/app/insti/adapter/FeedAdapter.java
app/src/main/java/app/insti/adapter/FeedAdapter.java
+4
-1
No files found.
app/src/main/java/app/insti/Constants.java
View file @
450acba0
...
...
@@ -32,4 +32,8 @@ public class Constants {
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_Y
=
{
0.09738953520399705
,
-
4.519868444089616
,
62.38493718381985
,
16.664561869057696
,
-
2.168377988768651
,
0.0919143297622087
,
0.32304266159540823
,
0.21688067854428716
,
-
12.81393255320748
};
public
static
final
String
resizeImageUrl
(
String
url
,
Integer
dim
)
{
return
url
.
replace
(
"api.insti.app/static/"
,
"img.insti.app/static/"
+
dim
.
toString
()
+
"/"
);
}
}
app/src/main/java/app/insti/activity/MainActivity.java
View file @
450acba0
...
...
@@ -37,6 +37,7 @@ import com.google.firebase.iid.InstanceIdResult;
import
com.google.gson.JsonObject
;
import
com.squareup.picasso.Picasso
;
import
java.io.File
;
import
java.util.List
;
import
app.insti.Constants
;
...
...
@@ -66,6 +67,7 @@ import app.insti.fragment.QuickLinksFragment;
import
app.insti.fragment.SettingsFragment
;
import
app.insti.fragment.TrainingBlogFragment
;
import
app.insti.notifications.NotificationEventReceiver
;
import
okhttp3.Cache
;
import
okhttp3.OkHttpClient
;
import
retrofit2.Call
;
import
retrofit2.Callback
;
...
...
@@ -148,8 +150,6 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
}
}
fetchNotifications
();
checkLatestVersion
();
NotificationEventReceiver
.
setupAlarm
(
getApplicationContext
());
...
...
@@ -402,8 +402,15 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
public
boolean
onCreateOptionsMenu
(
Menu
menu
)
{
// Inflate the menu; this adds items to the action bar if it is present.
this
.
menu
=
menu
;
fetchNotifications
();
getMenuInflater
().
inflate
(
R
.
menu
.
main
,
this
.
menu
);
// Fetch notifictions if logged in or hide icon
if
(
session
.
isLoggedIn
())
{
fetchNotifications
();
}
else
{
this
.
menu
.
findItem
(
R
.
id
.
action_notifications
).
setVisible
(
false
);
}
return
true
;
}
...
...
@@ -548,8 +555,11 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
public
void
initPicasso
()
{
Picasso
.
Builder
builder
=
new
Picasso
.
Builder
(
getApplicationContext
());
OkHttpClient
.
Builder
client
=
new
OkHttpClient
.
Builder
();
Cache
cache
=
new
Cache
(
new
File
(
getApplicationContext
().
getCacheDir
(),
"http-cache"
),
100
*
1024
*
1024
);
client
.
cache
(
cache
);
builder
.
downloader
(
new
com
.
squareup
.
picasso
.
OkHttp3Downloader
((
new
OkHttpClient
.
Builder
()
.
build
()
client
.
build
()
)));
Picasso
built
=
builder
.
build
();
built
.
setIndicatorsEnabled
(
false
);
...
...
app/src/main/java/app/insti/adapter/BodyAdapter.java
View file @
450acba0
...
...
@@ -12,6 +12,7 @@ import com.squareup.picasso.Picasso;
import
java.util.List
;
import
app.insti.Constants
;
import
app.insti.ItemClickListener
;
import
app.insti.R
;
import
app.insti.data.Body
;
...
...
@@ -51,7 +52,9 @@ public class BodyAdapter extends RecyclerView.Adapter<BodyAdapter.ViewHolder> {
Body
body
=
bodyList
.
get
(
position
);
holder
.
name
.
setText
(
body
.
getBodyName
());
holder
.
description
.
setText
(
body
.
getBodyShortDescription
());
Picasso
.
get
().
load
(
body
.
getBodyImageURL
()).
resize
(
0
,
200
).
into
(
holder
.
image
);
Picasso
.
get
().
load
(
Constants
.
resizeImageUrl
(
body
.
getBodyImageURL
(),
200
)
).
into
(
holder
.
image
);
}
...
...
app/src/main/java/app/insti/adapter/FeedAdapter.java
View file @
450acba0
...
...
@@ -17,6 +17,7 @@ import java.util.List;
import
java.util.Calendar
;
import
app.insti.Constants
;
import
app.insti.ItemClickListener
;
import
app.insti.R
;
import
app.insti.data.Event
;
...
...
@@ -122,7 +123,9 @@ public class FeedAdapter extends RecyclerView.Adapter<FeedAdapter.ViewHolder> {
viewHolder
.
eventPicture
.
setVisibility
(
View
.
GONE
);
Picasso
.
get
().
load
(
currentEvent
.
getEventImageURL
()).
into
(
viewHolder
.
eventBigPicture
);
}
else
{
Picasso
.
get
().
load
(
currentEvent
.
getEventImageURL
()).
into
(
viewHolder
.
eventPicture
);
Picasso
.
get
().
load
(
Constants
.
resizeImageUrl
(
currentEvent
.
getEventImageURL
(),
200
)
).
into
(
viewHolder
.
eventPicture
);
}
}
...
...
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