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
e39640f0
Commit
e39640f0
authored
Oct 01, 2018
by
Varun Patil
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactore resizeImageUrl into Helpers
parent
40fa5576
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
17 additions
and
11 deletions
+17
-11
app/src/main/java/app/insti/Constants.java
app/src/main/java/app/insti/Constants.java
+0
-5
app/src/main/java/app/insti/Helpers.java
app/src/main/java/app/insti/Helpers.java
+10
-1
app/src/main/java/app/insti/InstiAppFirebaseMessagingService.java
...main/java/app/insti/InstiAppFirebaseMessagingService.java
+1
-1
app/src/main/java/app/insti/adapter/BodyAdapter.java
app/src/main/java/app/insti/adapter/BodyAdapter.java
+2
-1
app/src/main/java/app/insti/adapter/FeedAdapter.java
app/src/main/java/app/insti/adapter/FeedAdapter.java
+1
-1
app/src/main/java/app/insti/adapter/NotificationsAdapter.java
...src/main/java/app/insti/adapter/NotificationsAdapter.java
+3
-2
No files found.
app/src/main/java/app/insti/Constants.java
View file @
e39640f0
...
@@ -53,9 +53,4 @@ public class Constants {
...
@@ -53,9 +53,4 @@ 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_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
};
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
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
)
{
if
(
url
==
null
)
{
return
url
;
}
return
url
.
replace
(
"api.insti.app/static/"
,
"img.insti.app/static/"
+
dim
.
toString
()
+
"/"
);
}
}
}
app/src/main/java/app/insti/Helpers.java
View file @
e39640f0
...
@@ -10,7 +10,7 @@ import java.time.Instant;
...
@@ -10,7 +10,7 @@ import java.time.Instant;
public
final
class
Helpers
{
public
final
class
Helpers
{
public
static
final
void
loadImageWithPlaceholder
(
final
ImageView
imageView
,
final
String
url
)
{
public
static
final
void
loadImageWithPlaceholder
(
final
ImageView
imageView
,
final
String
url
)
{
Picasso
.
get
()
Picasso
.
get
()
.
load
(
Constants
.
resizeImageUrl
(
url
,
200
))
.
load
(
resizeImageUrl
(
url
))
.
into
(
imageView
,
new
Callback
()
{
.
into
(
imageView
,
new
Callback
()
{
@Override
@Override
public
void
onSuccess
()
{
public
void
onSuccess
()
{
...
@@ -23,4 +23,13 @@ public final class Helpers {
...
@@ -23,4 +23,13 @@ public final class Helpers {
public
void
onError
(
Exception
ex
)
{}
public
void
onError
(
Exception
ex
)
{}
});
});
}
}
public
static
final
String
resizeImageUrl
(
String
url
)
{
return
resizeImageUrl
(
url
,
200
);
}
public
static
final
String
resizeImageUrl
(
String
url
,
Integer
dim
)
{
if
(
url
==
null
)
{
return
url
;
}
return
url
.
replace
(
"api.insti.app/static/"
,
"img.insti.app/static/"
+
dim
.
toString
()
+
"/"
);
}
}
}
app/src/main/java/app/insti/InstiAppFirebaseMessagingService.java
View file @
e39640f0
...
@@ -138,7 +138,7 @@ public class InstiAppFirebaseMessagingService extends FirebaseMessagingService {
...
@@ -138,7 +138,7 @@ public class InstiAppFirebaseMessagingService extends FirebaseMessagingService {
Bitmap
largeIcon
=
null
;
Bitmap
largeIcon
=
null
;
if
(
largeIconUrl
!=
null
)
{
if
(
largeIconUrl
!=
null
)
{
largeIcon
=
getCroppedBitmap
(
largeIcon
=
getCroppedBitmap
(
Picasso
.
get
().
load
(
Constants
.
resizeImageUrl
(
largeIconUrl
,
200
)).
get
(),
200
);
Picasso
.
get
().
load
(
Helpers
.
resizeImageUrl
(
largeIconUrl
)).
get
(),
200
);
}
}
bitmaps
=
new
Bitmap
[]{
image
,
largeIcon
};
bitmaps
=
new
Bitmap
[]{
image
,
largeIcon
};
}
catch
(
IOException
e
)
{
}
catch
(
IOException
e
)
{
...
...
app/src/main/java/app/insti/adapter/BodyAdapter.java
View file @
e39640f0
...
@@ -17,6 +17,7 @@ import com.squareup.picasso.Picasso;
...
@@ -17,6 +17,7 @@ import com.squareup.picasso.Picasso;
import
java.util.List
;
import
java.util.List
;
import
app.insti.Constants
;
import
app.insti.Constants
;
import
app.insti.Helpers
;
import
app.insti.R
;
import
app.insti.R
;
import
app.insti.api.model.Body
;
import
app.insti.api.model.Body
;
import
app.insti.fragment.BodyFragment
;
import
app.insti.fragment.BodyFragment
;
...
@@ -72,7 +73,7 @@ public class BodyAdapter extends RecyclerView.Adapter<BodyAdapter.ViewHolder> {
...
@@ -72,7 +73,7 @@ public class BodyAdapter extends RecyclerView.Adapter<BodyAdapter.ViewHolder> {
holder
.
name
.
setText
(
body
.
getBodyName
());
holder
.
name
.
setText
(
body
.
getBodyName
());
holder
.
description
.
setText
(
body
.
getBodyShortDescription
());
holder
.
description
.
setText
(
body
.
getBodyShortDescription
());
Picasso
.
get
().
load
(
Picasso
.
get
().
load
(
Constants
.
resizeImageUrl
(
body
.
getBodyImageURL
(),
200
)
Helpers
.
resizeImageUrl
(
body
.
getBodyImageURL
()
)
).
into
(
holder
.
image
);
).
into
(
holder
.
image
);
}
}
...
...
app/src/main/java/app/insti/adapter/FeedAdapter.java
View file @
e39640f0
...
@@ -137,7 +137,7 @@ public class FeedAdapter extends RecyclerView.Adapter<FeedAdapter.ViewHolder> {
...
@@ -137,7 +137,7 @@ public class FeedAdapter extends RecyclerView.Adapter<FeedAdapter.ViewHolder> {
Helpers
.
loadImageWithPlaceholder
(
viewHolder
.
eventBigPicture
,
currentEvent
.
getEventImageURL
());
Helpers
.
loadImageWithPlaceholder
(
viewHolder
.
eventBigPicture
,
currentEvent
.
getEventImageURL
());
}
else
{
}
else
{
Picasso
.
get
().
load
(
Picasso
.
get
().
load
(
Constants
.
resizeImageUrl
(
currentEvent
.
getEventImageURL
(),
200
)
Helpers
.
resizeImageUrl
(
currentEvent
.
getEventImageURL
()
)
).
into
(
viewHolder
.
eventPicture
);
).
into
(
viewHolder
.
eventPicture
);
}
}
}
}
...
...
app/src/main/java/app/insti/adapter/NotificationsAdapter.java
View file @
e39640f0
...
@@ -14,6 +14,7 @@ import com.squareup.picasso.Picasso;
...
@@ -14,6 +14,7 @@ import com.squareup.picasso.Picasso;
import
java.util.List
;
import
java.util.List
;
import
app.insti.Constants
;
import
app.insti.Constants
;
import
app.insti.Helpers
;
import
app.insti.interfaces.ItemClickListener
;
import
app.insti.interfaces.ItemClickListener
;
import
app.insti.R
;
import
app.insti.R
;
import
app.insti.api.model.Event
;
import
app.insti.api.model.Event
;
...
@@ -55,13 +56,13 @@ public class NotificationsAdapter extends RecyclerView.Adapter<NotificationsAdap
...
@@ -55,13 +56,13 @@ public class NotificationsAdapter extends RecyclerView.Adapter<NotificationsAdap
if
(
appNotification
.
getNotificationActorType
().
contains
(
"event"
))
{
if
(
appNotification
.
getNotificationActorType
().
contains
(
"event"
))
{
Event
event
=
gson
.
fromJson
(
gson
.
toJson
(
appNotification
.
getNotificationActor
()),
Event
.
class
);
Event
event
=
gson
.
fromJson
(
gson
.
toJson
(
appNotification
.
getNotificationActor
()),
Event
.
class
);
Picasso
.
get
().
load
(
Picasso
.
get
().
load
(
Constants
.
resizeImageUrl
(
event
.
getEventImageURL
(),
200
)
Helpers
.
resizeImageUrl
(
event
.
getEventImageURL
()
)
).
into
(
viewholder
.
notificationPicture
);
).
into
(
viewholder
.
notificationPicture
);
viewholder
.
notificationTitle
.
setText
(
event
.
getEventName
());
viewholder
.
notificationTitle
.
setText
(
event
.
getEventName
());
}
else
if
(
appNotification
.
getNotificationActorType
().
contains
(
"newsentry"
))
{
}
else
if
(
appNotification
.
getNotificationActorType
().
contains
(
"newsentry"
))
{
NewsArticle
article
=
gson
.
fromJson
(
gson
.
toJson
(
appNotification
.
getNotificationActor
()),
NewsArticle
.
class
);
NewsArticle
article
=
gson
.
fromJson
(
gson
.
toJson
(
appNotification
.
getNotificationActor
()),
NewsArticle
.
class
);
Picasso
.
get
().
load
(
Picasso
.
get
().
load
(
Constants
.
resizeImageUrl
(
article
.
getBody
().
getBodyImageURL
(),
200
)
Helpers
.
resizeImageUrl
(
article
.
getBody
().
getBodyImageURL
()
)
).
into
(
viewholder
.
notificationPicture
);
).
into
(
viewholder
.
notificationPicture
);
viewholder
.
notificationTitle
.
setText
(
article
.
getTitle
());
viewholder
.
notificationTitle
.
setText
(
article
.
getTitle
());
}
else
if
(
appNotification
.
getNotificationActorType
().
contains
(
"blogentry"
))
{
}
else
if
(
appNotification
.
getNotificationActorType
().
contains
(
"blogentry"
))
{
...
...
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