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
6c2fa89e
Commit
6c2fa89e
authored
Jul 11, 2018
by
Varun Patil
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove dead code
parent
f81fe80e
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
0 additions
and
295 deletions
+0
-295
app/src/main/java/app/insti/MainActivity.java
app/src/main/java/app/insti/MainActivity.java
+0
-34
app/src/main/java/app/insti/adapter/NotificationsAdapter.java
...src/main/java/app/insti/adapter/NotificationsAdapter.java
+0
-1
app/src/main/java/app/insti/api/model/AppNotification.java
app/src/main/java/app/insti/api/model/AppNotification.java
+0
-75
app/src/main/java/app/insti/api/model/NotificationsRequest.java
...c/main/java/app/insti/api/model/NotificationsRequest.java
+0
-27
app/src/main/java/app/insti/api/model/NotificationsResponse.java
.../main/java/app/insti/api/model/NotificationsResponse.java
+0
-29
app/src/main/java/app/insti/fragment/NotificationsFragment.java
...c/main/java/app/insti/fragment/NotificationsFragment.java
+0
-3
app/src/main/java/app/insti/gcm/MyGcmListenerService.java
app/src/main/java/app/insti/gcm/MyGcmListenerService.java
+0
-52
app/src/main/java/app/insti/gcm/MyInstanceIDListenerService.java
.../main/java/app/insti/gcm/MyInstanceIDListenerService.java
+0
-15
app/src/main/java/app/insti/gcm/RegistrationIntentService.java
...rc/main/java/app/insti/gcm/RegistrationIntentService.java
+0
-59
No files found.
app/src/main/java/app/insti/MainActivity.java
View file @
6c2fa89e
...
@@ -27,7 +27,6 @@ import com.google.gson.Gson;
...
@@ -27,7 +27,6 @@ import com.google.gson.Gson;
import
com.squareup.picasso.Picasso
;
import
com.squareup.picasso.Picasso
;
import
app.insti.api.UnsafeOkHttpClient
;
import
app.insti.api.UnsafeOkHttpClient
;
import
app.insti.api.model.NotificationsResponse
;
import
app.insti.data.User
;
import
app.insti.data.User
;
import
app.insti.fragment.CalendarFragment
;
import
app.insti.fragment.CalendarFragment
;
import
app.insti.fragment.FeedFragment
;
import
app.insti.fragment.FeedFragment
;
...
@@ -52,7 +51,6 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
...
@@ -52,7 +51,6 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
private
static
final
String
TAG
=
"MainActivity"
;
private
static
final
String
TAG
=
"MainActivity"
;
SessionManager
session
;
SessionManager
session
;
NotificationsResponse
notificationsResponse
;
FeedFragment
feedFragment
;
FeedFragment
feedFragment
;
private
User
currentUser
;
private
User
currentUser
;
private
boolean
showNotifications
=
false
;
private
boolean
showNotifications
=
false
;
...
@@ -126,38 +124,6 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
...
@@ -126,38 +124,6 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
.
into
(
profilePictureImageView
);
.
into
(
profilePictureImageView
);
}
}
// private void fetchNotifications() {
// NotificationsRequest notificationsRequest = new NotificationsRequest(0, 20);
// RetrofitInterface retrofitInterface = ServiceGenerator.createService(RetrofitInterface.class);
// retrofitInterface.getNotifications(notificationsRequest).enqueue(new Callback<NotificationsResponse>() {
// @Override
// public void onResponse(Call<NotificationsResponse> call, Response<NotificationsResponse> response) {
// if (response.isSuccessful()) {
// notificationsResponse = response.body();
// if (showNotifications) {
// showNotifications();
// showNotifications = false;
// }
// }
// //Server Error
// }
//
// @Override
// public void onFailure(Call<NotificationsResponse> call, Throwable t) {
// //Network Error
// }
// });
// }
public
void
showNotifications
()
{
String
notificationsResponseJson
=
new
Gson
().
toJson
(
notificationsResponse
);
Bundle
bundle
=
new
Bundle
();
bundle
.
putString
(
Constants
.
NOTIFICATIONS_RESPONSE_JSON
,
notificationsResponseJson
);
NotificationsFragment
notificationsFragment
=
new
NotificationsFragment
();
notificationsFragment
.
setArguments
(
bundle
);
updateFragment
(
notificationsFragment
);
}
@Override
@Override
public
void
onBackPressed
()
{
public
void
onBackPressed
()
{
DrawerLayout
drawer
=
(
DrawerLayout
)
findViewById
(
R
.
id
.
drawer_layout
);
DrawerLayout
drawer
=
(
DrawerLayout
)
findViewById
(
R
.
id
.
drawer_layout
);
...
...
app/src/main/java/app/insti/adapter/NotificationsAdapter.java
View file @
6c2fa89e
...
@@ -15,7 +15,6 @@ import java.util.List;
...
@@ -15,7 +15,6 @@ import java.util.List;
import
app.insti.ItemClickListener
;
import
app.insti.ItemClickListener
;
import
app.insti.R
;
import
app.insti.R
;
import
app.insti.api.model.AppNotification
;
import
app.insti.data.Event
;
import
app.insti.data.Event
;
import
app.insti.data.Notification
;
import
app.insti.data.Notification
;
...
...
app/src/main/java/app/insti/api/model/AppNotification.java
deleted
100644 → 0
View file @
f81fe80e
package
app.insti.api.model
;
import
com.google.gson.annotations.SerializedName
;
public
class
AppNotification
{
@SerializedName
(
"notification_type"
)
private
int
notificationType
;
@SerializedName
(
"notification_id"
)
private
String
notificationId
;
@SerializedName
(
"notification_related_id"
)
private
String
notificationRelatedId
;
@SerializedName
(
"notification_name"
)
private
String
notificationName
;
@SerializedName
(
"notification_description"
)
private
String
notificationDescription
;
@SerializedName
(
"notification_image"
)
private
String
notificationImage
;
public
AppNotification
(
int
notificationType
,
String
notificationId
,
String
notificationRelatedId
,
String
notificationName
,
String
notificationDescription
,
String
notificationImage
)
{
this
.
notificationType
=
notificationType
;
this
.
notificationId
=
notificationId
;
this
.
notificationRelatedId
=
notificationRelatedId
;
this
.
notificationName
=
notificationName
;
this
.
notificationDescription
=
notificationDescription
;
this
.
notificationImage
=
notificationImage
;
}
public
int
getNotificationType
()
{
return
notificationType
;
}
public
void
setNotificationType
(
int
notificationType
)
{
this
.
notificationType
=
notificationType
;
}
public
String
getNotificationId
()
{
return
notificationId
;
}
public
void
setNotificationId
(
String
notificationId
)
{
this
.
notificationId
=
notificationId
;
}
public
String
getNotificationRelatedId
()
{
return
notificationRelatedId
;
}
public
void
setNotificationRelatedId
(
String
notificationRelatedId
)
{
this
.
notificationRelatedId
=
notificationRelatedId
;
}
public
String
getNotificationName
()
{
return
notificationName
;
}
public
void
setNotificationName
(
String
notificationName
)
{
this
.
notificationName
=
notificationName
;
}
public
String
getNotificationDescription
()
{
return
notificationDescription
;
}
public
void
setNotificationDescription
(
String
notificationDescription
)
{
this
.
notificationDescription
=
notificationDescription
;
}
public
String
getNotificationImage
()
{
return
notificationImage
;
}
public
void
setNotificationImage
(
String
notificationImage
)
{
this
.
notificationImage
=
notificationImage
;
}
}
app/src/main/java/app/insti/api/model/NotificationsRequest.java
deleted
100644 → 0
View file @
f81fe80e
package
app.insti.api.model
;
public
class
NotificationsRequest
{
private
int
from
;
private
int
to
;
public
NotificationsRequest
(
int
from
,
int
to
)
{
this
.
from
=
from
;
this
.
to
=
to
;
}
public
int
getFrom
()
{
return
from
;
}
public
void
setFrom
(
int
from
)
{
this
.
from
=
from
;
}
public
int
getTo
()
{
return
to
;
}
public
void
setTo
(
int
to
)
{
this
.
to
=
to
;
}
}
app/src/main/java/app/insti/api/model/NotificationsResponse.java
deleted
100644 → 0
View file @
f81fe80e
package
app.insti.api.model
;
import
java.util.List
;
public
class
NotificationsResponse
{
private
String
result
;
private
List
<
AppNotification
>
notifications
;
public
NotificationsResponse
(
String
result
,
List
<
AppNotification
>
notifications
)
{
this
.
result
=
result
;
this
.
notifications
=
notifications
;
}
public
String
getResult
()
{
return
result
;
}
public
void
setResult
(
String
result
)
{
this
.
result
=
result
;
}
public
List
<
AppNotification
>
getNotifications
()
{
return
notifications
;
}
public
void
setNotifications
(
List
<
AppNotification
>
notifications
)
{
this
.
notifications
=
notifications
;
}
}
app/src/main/java/app/insti/fragment/NotificationsFragment.java
View file @
6c2fa89e
...
@@ -11,7 +11,6 @@ import android.support.v7.widget.Toolbar;
...
@@ -11,7 +11,6 @@ import android.support.v7.widget.Toolbar;
import
android.view.LayoutInflater
;
import
android.view.LayoutInflater
;
import
android.view.View
;
import
android.view.View
;
import
android.view.ViewGroup
;
import
android.view.ViewGroup
;
import
android.widget.Toast
;
import
com.google.gson.Gson
;
import
com.google.gson.Gson
;
...
@@ -24,8 +23,6 @@ import app.insti.R;
...
@@ -24,8 +23,6 @@ import app.insti.R;
import
app.insti.adapter.NotificationsAdapter
;
import
app.insti.adapter.NotificationsAdapter
;
import
app.insti.api.RetrofitInterface
;
import
app.insti.api.RetrofitInterface
;
import
app.insti.api.ServiceGenerator
;
import
app.insti.api.ServiceGenerator
;
import
app.insti.api.model.AppNotification
;
import
app.insti.api.model.NotificationsResponse
;
import
app.insti.data.Notification
;
import
app.insti.data.Notification
;
import
retrofit2.Call
;
import
retrofit2.Call
;
import
retrofit2.Callback
;
import
retrofit2.Callback
;
...
...
app/src/main/java/app/insti/gcm/MyGcmListenerService.java
deleted
100644 → 0
View file @
f81fe80e
package
app.insti.gcm
;
import
android.app.NotificationManager
;
import
android.app.PendingIntent
;
import
android.content.Context
;
import
android.content.Intent
;
import
android.media.RingtoneManager
;
import
android.net.Uri
;
import
android.os.Bundle
;
import
android.support.v4.app.NotificationCompat
;
import
android.util.Log
;
import
com.google.android.gms.gcm.GcmListenerService
;
import
app.insti.MainActivity
;
import
app.insti.R
;
public
class
MyGcmListenerService
extends
GcmListenerService
{
private
static
final
String
TAG
=
"MyGcmListenerService"
;
@Override
public
void
onMessageReceived
(
String
s
,
Bundle
bundle
)
{
String
message
=
bundle
.
getString
(
"message"
);
Log
.
d
(
TAG
,
"From: "
+
s
);
Log
.
d
(
TAG
,
"Message: "
+
message
);
sendNotification
(
message
);
}
public
void
sendNotification
(
String
message
)
{
Intent
intent
=
new
Intent
(
this
,
MainActivity
.
class
);
intent
.
addFlags
(
Intent
.
FLAG_ACTIVITY_CLEAR_TOP
);
PendingIntent
pendingIntent
=
PendingIntent
.
getActivity
(
this
,
0
/* Request code */
,
intent
,
PendingIntent
.
FLAG_ONE_SHOT
);
Uri
defaultSoundUri
=
RingtoneManager
.
getDefaultUri
(
RingtoneManager
.
TYPE_NOTIFICATION
);
NotificationCompat
.
Builder
notificationBuilder
=
new
NotificationCompat
.
Builder
(
this
)
//TODO Change the notification icon
.
setSmallIcon
(
R
.
drawable
.
ic_notifications_white_24dp
)
.
setContentTitle
(
"GCM Message"
)
.
setContentText
(
message
)
.
setAutoCancel
(
true
)
.
setSound
(
defaultSoundUri
)
.
setContentIntent
(
pendingIntent
);
NotificationManager
notificationManager
=
(
NotificationManager
)
getSystemService
(
Context
.
NOTIFICATION_SERVICE
);
notificationManager
.
notify
(
0
/* ID of notification */
,
notificationBuilder
.
build
());
}
}
app/src/main/java/app/insti/gcm/MyInstanceIDListenerService.java
deleted
100644 → 0
View file @
f81fe80e
package
app.insti.gcm
;
import
android.content.Intent
;
import
com.google.android.gms.iid.InstanceIDListenerService
;
public
class
MyInstanceIDListenerService
extends
InstanceIDListenerService
{
@Override
public
void
onTokenRefresh
()
{
// Fetch updated Instance ID token and notify our app's server of any changes (if applicable).
Intent
intent
=
new
Intent
(
this
,
RegistrationIntentService
.
class
);
startService
(
intent
);
}
}
app/src/main/java/app/insti/gcm/RegistrationIntentService.java
deleted
100644 → 0
View file @
f81fe80e
package
app.insti.gcm
;
import
android.annotation.TargetApi
;
import
android.app.IntentService
;
import
android.content.Intent
;
import
android.content.SharedPreferences
;
import
android.os.Build
;
import
android.preference.PreferenceManager
;
import
android.support.annotation.Nullable
;
import
android.support.annotation.RequiresApi
;
import
android.support.v4.content.LocalBroadcastManager
;
import
android.util.Log
;
import
android.widget.Toast
;
import
com.google.android.gms.gcm.GoogleCloudMessaging
;
import
com.google.android.gms.iid.InstanceID
;
import
app.insti.Constants
;
@TargetApi
(
Build
.
VERSION_CODES
.
CUPCAKE
)
public
class
RegistrationIntentService
extends
IntentService
{
private
static
final
String
TAG
=
"RegIntentService"
;
@RequiresApi
(
api
=
Build
.
VERSION_CODES
.
CUPCAKE
)
public
RegistrationIntentService
()
{
super
(
TAG
);
}
@RequiresApi
(
api
=
Build
.
VERSION_CODES
.
GINGERBREAD
)
@Override
protected
void
onHandleIntent
(
@Nullable
Intent
intent
)
{
String
token
=
null
;
SharedPreferences
sharedPreferences
=
PreferenceManager
.
getDefaultSharedPreferences
(
this
);
try
{
InstanceID
instanceID
=
InstanceID
.
getInstance
(
this
);
token
=
instanceID
.
getToken
(
"306601329049"
,
GoogleCloudMessaging
.
INSTANCE_ID_SCOPE
,
null
);
Log
.
i
(
TAG
,
"GCM Registration Token: "
+
token
);
Toast
.
makeText
(
this
,
"GCM Registration Token: "
+
token
,
Toast
.
LENGTH_SHORT
).
show
();
sharedPreferences
.
edit
().
putBoolean
(
Constants
.
SENT_TOKEN_TO_SERVER
,
true
).
apply
();
}
catch
(
Exception
e
)
{
Log
.
d
(
TAG
,
"Failed to complete token refresh"
,
e
);
sharedPreferences
.
edit
().
putBoolean
(
Constants
.
SENT_TOKEN_TO_SERVER
,
false
).
apply
();
}
//Notify UI that registration is complete
Intent
registrationComplete
=
new
Intent
(
Constants
.
REGISTRATION_COMPLETE
);
registrationComplete
.
putExtra
(
"Token"
,
token
);
LocalBroadcastManager
.
getInstance
(
this
).
sendBroadcast
(
registrationComplete
);
}
}
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