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
67138833
Commit
67138833
authored
Mar 29, 2018
by
Sajal Narang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Reformat code, fix #63
parent
98d307da
Changes
29
Hide whitespace changes
Inline
Side-by-side
Showing
29 changed files
with
345 additions
and
332 deletions
+345
-332
app/src/main/AndroidManifest.xml
app/src/main/AndroidManifest.xml
+1
-1
app/src/main/java/in/ac/iitb/gymkhana/iitbapp/ActivityBuffer.java
...main/java/in/ac/iitb/gymkhana/iitbapp/ActivityBuffer.java
+56
-33
app/src/main/java/in/ac/iitb/gymkhana/iitbapp/Constants.java
app/src/main/java/in/ac/iitb/gymkhana/iitbapp/Constants.java
+8
-0
app/src/main/java/in/ac/iitb/gymkhana/iitbapp/LoginActivity.java
.../main/java/in/ac/iitb/gymkhana/iitbapp/LoginActivity.java
+2
-4
app/src/main/java/in/ac/iitb/gymkhana/iitbapp/MainActivity.java
...c/main/java/in/ac/iitb/gymkhana/iitbapp/MainActivity.java
+3
-11
app/src/main/java/in/ac/iitb/gymkhana/iitbapp/SessionManager.java
...main/java/in/ac/iitb/gymkhana/iitbapp/SessionManager.java
+6
-11
app/src/main/java/in/ac/iitb/gymkhana/iitbapp/adapter/FeedAdapter.java
...java/in/ac/iitb/gymkhana/iitbapp/adapter/FeedAdapter.java
+2
-2
app/src/main/java/in/ac/iitb/gymkhana/iitbapp/api/model/EventCreateRequest.java
...c/iitb/gymkhana/iitbapp/api/model/EventCreateRequest.java
+0
-4
app/src/main/java/in/ac/iitb/gymkhana/iitbapp/api/model/EventCreateResponse.java
.../iitb/gymkhana/iitbapp/api/model/EventCreateResponse.java
+3
-5
app/src/main/java/in/ac/iitb/gymkhana/iitbapp/api/model/LoginResponse.java
.../in/ac/iitb/gymkhana/iitbapp/api/model/LoginResponse.java
+1
-0
app/src/main/java/in/ac/iitb/gymkhana/iitbapp/data/AppDatabase.java
...in/java/in/ac/iitb/gymkhana/iitbapp/data/AppDatabase.java
+3
-3
app/src/main/java/in/ac/iitb/gymkhana/iitbapp/data/Converters.java
...ain/java/in/ac/iitb/gymkhana/iitbapp/data/Converters.java
+10
-6
app/src/main/java/in/ac/iitb/gymkhana/iitbapp/data/DbDao.java
...src/main/java/in/ac/iitb/gymkhana/iitbapp/data/DbDao.java
+0
-2
app/src/main/java/in/ac/iitb/gymkhana/iitbapp/data/User.java
app/src/main/java/in/ac/iitb/gymkhana/iitbapp/data/User.java
+4
-7
app/src/main/java/in/ac/iitb/gymkhana/iitbapp/fragment/AddEventFragment.java
...n/ac/iitb/gymkhana/iitbapp/fragment/AddEventFragment.java
+14
-16
app/src/main/java/in/ac/iitb/gymkhana/iitbapp/fragment/BaseFragment.java
...va/in/ac/iitb/gymkhana/iitbapp/fragment/BaseFragment.java
+4
-10
app/src/main/java/in/ac/iitb/gymkhana/iitbapp/fragment/EventFragment.java
...a/in/ac/iitb/gymkhana/iitbapp/fragment/EventFragment.java
+2
-4
app/src/main/java/in/ac/iitb/gymkhana/iitbapp/fragment/FeedFragment.java
...va/in/ac/iitb/gymkhana/iitbapp/fragment/FeedFragment.java
+3
-5
app/src/main/java/in/ac/iitb/gymkhana/iitbapp/fragment/MapFragment.java
...ava/in/ac/iitb/gymkhana/iitbapp/fragment/MapFragment.java
+19
-18
app/src/main/java/in/ac/iitb/gymkhana/iitbapp/fragment/MyEventsFragment.java
...n/ac/iitb/gymkhana/iitbapp/fragment/MyEventsFragment.java
+2
-2
app/src/main/java/in/ac/iitb/gymkhana/iitbapp/fragment/PeopleFragment.java
.../in/ac/iitb/gymkhana/iitbapp/fragment/PeopleFragment.java
+0
-1
app/src/main/java/in/ac/iitb/gymkhana/iitbapp/fragment/ProfileFragment.java
...in/ac/iitb/gymkhana/iitbapp/fragment/ProfileFragment.java
+1
-3
app/src/main/java/in/ac/iitb/gymkhana/iitbapp/gcm/RegistrationIntentService.java
.../iitb/gymkhana/iitbapp/gcm/RegistrationIntentService.java
+5
-7
app/src/main/res/layout/feed_card.xml
app/src/main/res/layout/feed_card.xml
+71
-65
app/src/main/res/layout/fragment_add_event.xml
app/src/main/res/layout/fragment_add_event.xml
+45
-42
app/src/main/res/layout/fragment_event.xml
app/src/main/res/layout/fragment_event.xml
+46
-38
app/src/main/res/layout/fragment_feed.xml
app/src/main/res/layout/fragment_feed.xml
+12
-11
app/src/main/res/layout/fragment_my_events.xml
app/src/main/res/layout/fragment_my_events.xml
+4
-3
app/src/main/res/layout/fragment_profile.xml
app/src/main/res/layout/fragment_profile.xml
+18
-18
No files found.
app/src/main/AndroidManifest.xml
View file @
67138833
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<manifest
xmlns:android=
"http://schemas.android.com/apk/res/android"
<manifest
xmlns:android=
"http://schemas.android.com/apk/res/android"
package=
"in.ac.iitb.gymkhana.iitbapp"
>
package=
"in.ac.iitb.gymkhana.iitbapp"
>
<uses-permission
android:name=
"android.permission.ACCESS_FINE_LOCATION"
/>
<uses-permission
android:name=
"android.permission.ACCESS_FINE_LOCATION"
/>
<uses-permission
android:name=
"android.permission.ACCESS_COARSE_LOCATION"
/>
<uses-permission
android:name=
"android.permission.ACCESS_COARSE_LOCATION"
/>
...
...
app/src/main/java/in/ac/iitb/gymkhana/iitbapp/ActivityBuffer.java
View file @
67138833
...
@@ -5,59 +5,68 @@ import android.app.Activity;
...
@@ -5,59 +5,68 @@ import android.app.Activity;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.List
;
/** A class which maintains a list of transactions to occur when Context becomes available. */
/**
* A class which maintains a list of transactions to occur when Context becomes available.
*/
public
final
class
ActivityBuffer
{
public
final
class
ActivityBuffer
{
/** A class which defines operations to execute once there's an available Context. */
public
interface
IRunnable
{
/** Executes when there's an available Context. Ideally, will it operate immediately. */
void
run
(
final
Activity
pActivity
);
}
/* Member Variables. */
private
Activity
mActivity
;
private
final
List
<
IRunnable
>
mRunnables
;
private
final
List
<
IRunnable
>
mRunnables
;
/* Member Variables. */
private
Activity
mActivity
;
/** Constructor. */
/**
* Constructor.
*/
public
ActivityBuffer
()
{
public
ActivityBuffer
()
{
// Initialize Member Variables.
// Initialize Member Variables.
this
.
mActivity
=
null
;
this
.
mActivity
=
null
;
this
.
mRunnables
=
new
ArrayList
<
IRunnable
>();
this
.
mRunnables
=
new
ArrayList
<
IRunnable
>();
}
}
/** Executes the Runnable if there's an available Context. Otherwise, defers execution until it becomes available. */
/**
* Executes the Runnable if there's an available Context. Otherwise, defers execution until it becomes available.
*/
public
final
void
safely
(
final
IRunnable
pRunnable
)
{
public
final
void
safely
(
final
IRunnable
pRunnable
)
{
// Synchronize along the current instance.
// Synchronize along the current instance.
synchronized
(
this
)
{
synchronized
(
this
)
{
// Do we have a context available?
// Do we have a context available?
if
(
this
.
isContextAvailable
())
{
if
(
this
.
isContextAvailable
())
{
// Fetch the Activity.
// Fetch the Activity.
final
Activity
lActivity
=
this
.
getActivity
();
final
Activity
lActivity
=
this
.
getActivity
();
// Execute the Runnable along the Activity.
// Execute the Runnable along the Activity.
lActivity
.
runOnUiThread
(
new
Runnable
()
{
@Override
public
final
void
run
()
{
pRunnable
.
run
(
lActivity
);
}
});
lActivity
.
runOnUiThread
(
new
Runnable
()
{
}
@Override
else
{
public
final
void
run
()
{
pRunnable
.
run
(
lActivity
);
}
});
}
else
{
// Buffer the Runnable so that it's ready to receive a valid reference.
// Buffer the Runnable so that it's ready to receive a valid reference.
this
.
getRunnables
().
add
(
pRunnable
);
this
.
getRunnables
().
add
(
pRunnable
);
}
}
}
}
}
}
/** Called to inform the ActivityBuffer that there's an available Activity reference. */
/**
* Called to inform the ActivityBuffer that there's an available Activity reference.
*/
public
final
void
onContextGained
(
final
Activity
pActivity
)
{
public
final
void
onContextGained
(
final
Activity
pActivity
)
{
// Synchronize along ourself.
// Synchronize along ourself.
synchronized
(
this
)
{
synchronized
(
this
)
{
// Update the Activity reference.
// Update the Activity reference.
this
.
setActivity
(
pActivity
);
this
.
setActivity
(
pActivity
);
// Are there any Runnables awaiting execution?
// Are there any Runnables awaiting execution?
if
(!
this
.
getRunnables
().
isEmpty
())
{
if
(!
this
.
getRunnables
().
isEmpty
())
{
// Iterate the Runnables.
// Iterate the Runnables.
for
(
final
IRunnable
lRunnable
:
this
.
getRunnables
())
{
for
(
final
IRunnable
lRunnable
:
this
.
getRunnables
())
{
// Execute the Runnable on the UI Thread.
// Execute the Runnable on the UI Thread.
pActivity
.
runOnUiThread
(
new
Runnable
()
{
@Override
public
final
void
run
()
{
pActivity
.
runOnUiThread
(
new
Runnable
()
{
// Execute the Runnable.
@Override
lRunnable
.
run
(
pActivity
);
public
final
void
run
()
{
}
});
// Execute the Runnable.
lRunnable
.
run
(
pActivity
);
}
});
}
}
// Empty the Runnables.
// Empty the Runnables.
this
.
getRunnables
().
clear
();
this
.
getRunnables
().
clear
();
...
@@ -65,35 +74,49 @@ public final class ActivityBuffer {
...
@@ -65,35 +74,49 @@ public final class ActivityBuffer {
}
}
}
}
/** Called to inform the ActivityBuffer that the Context has been lost. */
/**
* Called to inform the ActivityBuffer that the Context has been lost.
*/
public
final
void
onContextLost
()
{
public
final
void
onContextLost
()
{
// Synchronize along ourself.
// Synchronize along ourself.
synchronized
(
this
)
{
synchronized
(
this
)
{
// Remove the Context reference.
// Remove the Context reference.
this
.
setActivity
(
null
);
this
.
setActivity
(
null
);
}
}
}
}
/** Defines whether there's a safe Context available for the ActivityBuffer. */
/**
* Defines whether there's a safe Context available for the ActivityBuffer.
*/
public
final
boolean
isContextAvailable
()
{
public
final
boolean
isContextAvailable
()
{
// Synchronize upon ourself.
// Synchronize upon ourself.
synchronized
(
this
)
{
synchronized
(
this
)
{
// Return the state of the Activity reference.
// Return the state of the Activity reference.
return
(
this
.
getActivity
()
!=
null
);
return
(
this
.
getActivity
()
!=
null
);
}
}
}
}
private
final
Activity
getActivity
()
{
return
this
.
mActivity
;
}
/* Getters and Setters. */
/* Getters and Setters. */
private
final
void
setActivity
(
final
Activity
pActivity
)
{
private
final
void
setActivity
(
final
Activity
pActivity
)
{
this
.
mActivity
=
pActivity
;
this
.
mActivity
=
pActivity
;
}
}
private
final
Activity
getActivity
()
{
return
this
.
mActivity
;
}
private
final
List
<
IRunnable
>
getRunnables
()
{
private
final
List
<
IRunnable
>
getRunnables
()
{
return
this
.
mRunnables
;
return
this
.
mRunnables
;
}
}
/**
* A class which defines operations to execute once there's an available Context.
*/
public
interface
IRunnable
{
/**
* Executes when there's an available Context. Ideally, will it operate immediately.
*/
void
run
(
final
Activity
pActivity
);
}
}
}
\ No newline at end of file
app/src/main/java/in/ac/iitb/gymkhana/iitbapp/Constants.java
View file @
67138833
...
@@ -3,10 +3,18 @@ package in.ac.iitb.gymkhana.iitbapp;
...
@@ -3,10 +3,18 @@ package in.ac.iitb.gymkhana.iitbapp;
public
class
Constants
{
public
class
Constants
{
public
static
final
int
MY_PERMISSIONS_REQUEST_READ_EXTERNAL_STORAGE
=
1
;
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_ACCESS_LOCATION
=
2
;
public
static
final
int
MY_PERMISSIONS_REQUEST_LOCATION
=
3
;
public
static
final
int
RESULT_LOAD_IMAGE
=
11
;
public
static
final
int
RESULT_LOAD_IMAGE
=
11
;
public
static
final
String
NOTIFICATIONS_RESPONSE_JSON
=
"notifications_json"
;
public
static
final
String
NOTIFICATIONS_RESPONSE_JSON
=
"notifications_json"
;
public
static
final
String
EVENT_JSON
=
"event_json"
;
public
static
final
String
EVENT_JSON
=
"event_json"
;
public
static
final
String
USER_ID
=
"user_id"
;
public
static
final
String
USER_ID
=
"user_id"
;
public
static
final
String
SENT_TOKEN_TO_SERVER
=
"sentTokenToServer"
;
public
static
final
String
REGISTRATION_COMPLETE
=
"registrationComplete"
;
public
static
final
String
PREF_NAME
=
"LoggedInPref"
;
public
static
final
String
IS_LOGGED_IN
=
"IsLoggedIn"
;
public
static
final
String
GCM_ID
=
"GcmId"
;
public
static
final
String
CURRENT_USER
=
"current_user"
;
public
static
final
String
SESSION_ID
=
"session_id"
;
public
static
final
int
STATUS_GOING
=
2
;
public
static
final
int
STATUS_GOING
=
2
;
public
static
final
int
STATUS_INTERESTED
=
1
;
public
static
final
int
STATUS_INTERESTED
=
1
;
...
...
app/src/main/java/in/ac/iitb/gymkhana/iitbapp/LoginActivity.java
View file @
67138833
...
@@ -40,8 +40,6 @@ import retrofit2.Response;
...
@@ -40,8 +40,6 @@ import retrofit2.Response;
public
class
LoginActivity
extends
AppCompatActivity
{
public
class
LoginActivity
extends
AppCompatActivity
{
public
static
final
String
SENT_TOKEN_TO_SERVER
=
"sentTokenToServer"
;
public
static
final
String
REGISTRATION_COMPLETE
=
"registrationComplete"
;
private
static
final
String
TAG
=
"LoginActivity"
;
private
static
final
String
TAG
=
"LoginActivity"
;
private
static
final
int
PLAY_SERVICES_RESOLUTION_REQUEST
=
9000
;
private
static
final
int
PLAY_SERVICES_RESOLUTION_REQUEST
=
9000
;
//TODO: Change this to production before launch
//TODO: Change this to production before launch
...
@@ -67,7 +65,7 @@ public class LoginActivity extends AppCompatActivity {
...
@@ -67,7 +65,7 @@ public class LoginActivity extends AppCompatActivity {
public
void
onReceive
(
Context
context
,
Intent
intent
)
{
public
void
onReceive
(
Context
context
,
Intent
intent
)
{
SharedPreferences
sharedPreferences
=
PreferenceManager
.
getDefaultSharedPreferences
(
context
);
SharedPreferences
sharedPreferences
=
PreferenceManager
.
getDefaultSharedPreferences
(
context
);
boolean
sentToken
=
sharedPreferences
.
getBoolean
(
SENT_TOKEN_TO_SERVER
,
false
);
boolean
sentToken
=
sharedPreferences
.
getBoolean
(
Constants
.
SENT_TOKEN_TO_SERVER
,
false
);
if
(
sentToken
)
{
if
(
sentToken
)
{
String
token
=
intent
.
getStringExtra
(
"Token"
);
String
token
=
intent
.
getStringExtra
(
"Token"
);
Log
.
d
(
TAG
,
"Going to login with :"
+
authCode
+
"\n"
+
token
);
Log
.
d
(
TAG
,
"Going to login with :"
+
authCode
+
"\n"
+
token
);
...
@@ -254,7 +252,7 @@ public class LoginActivity extends AppCompatActivity {
...
@@ -254,7 +252,7 @@ public class LoginActivity extends AppCompatActivity {
private
void
registerReceiver
()
{
private
void
registerReceiver
()
{
if
(!
isReceiverRegistered
)
{
if
(!
isReceiverRegistered
)
{
LocalBroadcastManager
.
getInstance
(
this
).
registerReceiver
(
mRegistrationBroadcastReceiver
,
LocalBroadcastManager
.
getInstance
(
this
).
registerReceiver
(
mRegistrationBroadcastReceiver
,
new
IntentFilter
(
REGISTRATION_COMPLETE
));
new
IntentFilter
(
Constants
.
REGISTRATION_COMPLETE
));
isReceiverRegistered
=
true
;
isReceiverRegistered
=
true
;
}
}
}
}
...
...
app/src/main/java/in/ac/iitb/gymkhana/iitbapp/MainActivity.java
View file @
67138833
...
@@ -4,7 +4,6 @@ import android.Manifest;
...
@@ -4,7 +4,6 @@ import android.Manifest;
import
android.content.Intent
;
import
android.content.Intent
;
import
android.content.pm.PackageManager
;
import
android.content.pm.PackageManager
;
import
android.os.Bundle
;
import
android.os.Bundle
;
import
android.preference.PreferenceManager
;
import
android.support.design.widget.NavigationView
;
import
android.support.design.widget.NavigationView
;
import
android.support.v4.app.ActivityCompat
;
import
android.support.v4.app.ActivityCompat
;
import
android.support.v4.app.Fragment
;
import
android.support.v4.app.Fragment
;
...
@@ -26,9 +25,6 @@ import android.widget.Toast;
...
@@ -26,9 +25,6 @@ import android.widget.Toast;
import
com.google.gson.Gson
;
import
com.google.gson.Gson
;
import
com.squareup.picasso.Picasso
;
import
com.squareup.picasso.Picasso
;
import
in.ac.iitb.gymkhana.iitbapp.api.RetrofitInterface
;
import
in.ac.iitb.gymkhana.iitbapp.api.ServiceGenerator
;
import
in.ac.iitb.gymkhana.iitbapp.api.model.NotificationsRequest
;
import
in.ac.iitb.gymkhana.iitbapp.api.model.NotificationsResponse
;
import
in.ac.iitb.gymkhana.iitbapp.api.model.NotificationsResponse
;
import
in.ac.iitb.gymkhana.iitbapp.data.User
;
import
in.ac.iitb.gymkhana.iitbapp.data.User
;
import
in.ac.iitb.gymkhana.iitbapp.fragment.AboutFragment
;
import
in.ac.iitb.gymkhana.iitbapp.fragment.AboutFragment
;
...
@@ -45,14 +41,10 @@ import in.ac.iitb.gymkhana.iitbapp.fragment.PTCellFragment;
...
@@ -45,14 +41,10 @@ import in.ac.iitb.gymkhana.iitbapp.fragment.PTCellFragment;
import
in.ac.iitb.gymkhana.iitbapp.fragment.PeopleFragment
;
import
in.ac.iitb.gymkhana.iitbapp.fragment.PeopleFragment
;
import
in.ac.iitb.gymkhana.iitbapp.fragment.ProfileFragment
;
import
in.ac.iitb.gymkhana.iitbapp.fragment.ProfileFragment
;
import
in.ac.iitb.gymkhana.iitbapp.fragment.TimetableFragment
;
import
in.ac.iitb.gymkhana.iitbapp.fragment.TimetableFragment
;
import
retrofit2.Call
;
import
retrofit2.Callback
;
import
retrofit2.Response
;
import
static
in
.
ac
.
iitb
.
gymkhana
.
iitbapp
.
Constants
.
MY_PERMISSIONS_REQUEST_ACCESS_LOCATION
;
import
static
in
.
ac
.
iitb
.
gymkhana
.
iitbapp
.
Constants
.
MY_PERMISSIONS_REQUEST_ACCESS_LOCATION
;
import
static
in
.
ac
.
iitb
.
gymkhana
.
iitbapp
.
Constants
.
MY_PERMISSIONS_REQUEST_READ_EXTERNAL_STORAGE
;
import
static
in
.
ac
.
iitb
.
gymkhana
.
iitbapp
.
Constants
.
MY_PERMISSIONS_REQUEST_READ_EXTERNAL_STORAGE
;
import
static
in
.
ac
.
iitb
.
gymkhana
.
iitbapp
.
Constants
.
RESULT_LOAD_IMAGE
;
import
static
in
.
ac
.
iitb
.
gymkhana
.
iitbapp
.
Constants
.
RESULT_LOAD_IMAGE
;
import
static
in
.
ac
.
iitb
.
gymkhana
.
iitbapp
.
SessionManager
.
SESSION_ID
;
public
class
MainActivity
extends
AppCompatActivity
public
class
MainActivity
extends
AppCompatActivity
...
@@ -60,9 +52,9 @@ public class MainActivity extends AppCompatActivity
...
@@ -60,9 +52,9 @@ public class MainActivity extends AppCompatActivity
private
static
final
String
TAG
=
"MainActivity"
;
private
static
final
String
TAG
=
"MainActivity"
;
private
User
currentUser
;
SessionManager
session
;
SessionManager
session
;
NotificationsResponse
notificationsResponse
;
NotificationsResponse
notificationsResponse
;
private
User
currentUser
;
private
boolean
showNotifications
=
false
;
private
boolean
showNotifications
=
false
;
@Override
@Override
...
@@ -92,7 +84,7 @@ public class MainActivity extends AppCompatActivity
...
@@ -92,7 +84,7 @@ public class MainActivity extends AppCompatActivity
protected
void
onStart
()
{
protected
void
onStart
()
{
super
.
onStart
();
super
.
onStart
();
if
(
session
.
isLoggedIn
())
{
if
(
session
.
isLoggedIn
())
{
currentUser
=
User
.
fromString
(
session
.
pref
.
getString
(
SessionManager
.
CURRENT_USER
,
"Error"
));
currentUser
=
User
.
fromString
(
session
.
pref
.
getString
(
Constants
.
CURRENT_USER
,
"Error"
));
updateNavigationView
();
updateNavigationView
();
}
}
}
}
...
@@ -259,7 +251,7 @@ public class MainActivity extends AppCompatActivity
...
@@ -259,7 +251,7 @@ public class MainActivity extends AppCompatActivity
private
void
updateFragment
(
Fragment
fragment
)
{
private
void
updateFragment
(
Fragment
fragment
)
{
Bundle
bundle
=
new
Bundle
();
Bundle
bundle
=
new
Bundle
();
bundle
.
putString
(
SESSION_ID
,
session
.
pref
.
getString
(
SESSION_ID
,
"Error"
));
bundle
.
putString
(
Constants
.
SESSION_ID
,
session
.
pref
.
getString
(
Constants
.
SESSION_ID
,
"Error"
));
fragment
.
setArguments
(
bundle
);
fragment
.
setArguments
(
bundle
);
FragmentManager
manager
=
getSupportFragmentManager
();
FragmentManager
manager
=
getSupportFragmentManager
();
FragmentTransaction
transaction
=
manager
.
beginTransaction
();
FragmentTransaction
transaction
=
manager
.
beginTransaction
();
...
...
app/src/main/java/in/ac/iitb/gymkhana/iitbapp/SessionManager.java
View file @
67138833
...
@@ -9,11 +9,6 @@ import android.util.Log;
...
@@ -9,11 +9,6 @@ import android.util.Log;
import
in.ac.iitb.gymkhana.iitbapp.data.User
;
import
in.ac.iitb.gymkhana.iitbapp.data.User
;
public
class
SessionManager
{
public
class
SessionManager
{
private
static
final
String
PREF_NAME
=
"LoggedInPref"
;
private
static
final
String
IS_LOGGED_IN
=
"IsLoggedIn"
;
private
static
final
String
GCM_ID
=
"GcmId"
;
public
static
final
String
CURRENT_USER
=
"current_user"
;
public
static
final
String
SESSION_ID
=
"session_id"
;
SharedPreferences
pref
;
SharedPreferences
pref
;
Editor
editor
;
Editor
editor
;
Context
context
;
Context
context
;
...
@@ -21,7 +16,7 @@ public class SessionManager {
...
@@ -21,7 +16,7 @@ public class SessionManager {
public
SessionManager
(
Context
context
)
{
public
SessionManager
(
Context
context
)
{
this
.
context
=
context
;
this
.
context
=
context
;
pref
=
context
.
getSharedPreferences
(
PREF_NAME
,
PRIVATE_MODE
);
pref
=
context
.
getSharedPreferences
(
Constants
.
PREF_NAME
,
PRIVATE_MODE
);
editor
=
pref
.
edit
();
editor
=
pref
.
edit
();
}
}
...
@@ -39,14 +34,14 @@ public class SessionManager {
...
@@ -39,14 +34,14 @@ public class SessionManager {
public
void
createLoginSession
(
String
gcmId
,
User
currentUser
,
String
sessionID
)
{
public
void
createLoginSession
(
String
gcmId
,
User
currentUser
,
String
sessionID
)
{
Log
.
d
(
"SessionManager"
,
"GcmId being stored"
);
Log
.
d
(
"SessionManager"
,
"GcmId being stored"
);
editor
.
putBoolean
(
IS_LOGGED_IN
,
true
);
editor
.
putBoolean
(
Constants
.
IS_LOGGED_IN
,
true
);
editor
.
putString
(
GCM_ID
,
gcmId
);
editor
.
putString
(
Constants
.
GCM_ID
,
gcmId
);
editor
.
putString
(
CURRENT_USER
,
currentUser
.
toString
());
editor
.
putString
(
C
onstants
.
C
URRENT_USER
,
currentUser
.
toString
());
editor
.
putString
(
SESSION_ID
,
sessionID
);
editor
.
putString
(
Constants
.
SESSION_ID
,
sessionID
);
editor
.
commit
();
editor
.
commit
();
}
}
public
boolean
isLoggedIn
()
{
public
boolean
isLoggedIn
()
{
return
pref
.
getBoolean
(
IS_LOGGED_IN
,
false
);
return
pref
.
getBoolean
(
Constants
.
IS_LOGGED_IN
,
false
);
}
}
}
}
app/src/main/java/in/ac/iitb/gymkhana/iitbapp/adapter/FeedAdapter.java
View file @
67138833
...
@@ -66,7 +66,7 @@ public class FeedAdapter extends RecyclerView.Adapter<FeedAdapter.ViewHolder> {
...
@@ -66,7 +66,7 @@ public class FeedAdapter extends RecyclerView.Adapter<FeedAdapter.ViewHolder> {
if
(!
eventVenueName
.
toString
().
equals
(
""
))
if
(!
eventVenueName
.
toString
().
equals
(
""
))
viewHolder
.
eventVenue
.
setText
(
eventVenueName
.
toString
().
substring
(
2
));
viewHolder
.
eventVenue
.
setText
(
eventVenueName
.
toString
().
substring
(
2
));
Picasso
.
with
(
context
).
load
(
currentEvent
.
getEventImageURL
()).
resize
(
320
,
0
).
into
(
viewHolder
.
eventPicture
);
Picasso
.
with
(
context
).
load
(
currentEvent
.
getEventImageURL
()).
resize
(
320
,
0
).
into
(
viewHolder
.
eventPicture
);
}
}
@Override
@Override
...
@@ -77,7 +77,7 @@ public class FeedAdapter extends RecyclerView.Adapter<FeedAdapter.ViewHolder> {
...
@@ -77,7 +77,7 @@ public class FeedAdapter extends RecyclerView.Adapter<FeedAdapter.ViewHolder> {
public
class
ViewHolder
extends
RecyclerView
.
ViewHolder
{
public
class
ViewHolder
extends
RecyclerView
.
ViewHolder
{
private
ImageView
eventPicture
;
private
ImageView
eventPicture
;
private
TextView
eventTitle
;
private
TextView
eventTitle
;
// private TextView eventDetails;
// private TextView eventDetails;
private
TextView
eventDate
;
private
TextView
eventDate
;
private
TextView
eventTime
;
private
TextView
eventTime
;
private
TextView
eventVenue
;
private
TextView
eventVenue
;
...
...
app/src/main/java/in/ac/iitb/gymkhana/iitbapp/api/model/EventCreateRequest.java
View file @
67138833
package
in.ac.iitb.gymkhana.iitbapp.api.model
;
package
in.ac.iitb.gymkhana.iitbapp.api.model
;
import
android.media.Image
;
import
android.support.annotation.Nullable
;
import
com.google.gson.annotations.SerializedName
;
import
com.google.gson.annotations.SerializedName
;
import
java.sql.Timestamp
;
import
java.util.List
;
import
java.util.List
;
public
class
EventCreateRequest
{
public
class
EventCreateRequest
{
...
...
app/src/main/java/in/ac/iitb/gymkhana/iitbapp/api/model/EventCreateResponse.java
View file @
67138833
package
in.ac.iitb.gymkhana.iitbapp.api.model
;
package
in.ac.iitb.gymkhana.iitbapp.api.model
;
import
com.google.gson.annotations.SerializedName
;
/**
/**
* Created by mrunz on 15/7/17.
* Created by mrunz on 15/7/17.
*/
*/
...
@@ -13,9 +11,9 @@ public class EventCreateResponse {
...
@@ -13,9 +11,9 @@ public class EventCreateResponse {
private
String
eventId
;
private
String
eventId
;
public
EventCreateResponse
(
String
result
,
String
eventId
)
{
public
EventCreateResponse
(
String
result
,
String
eventId
)
{
this
.
result
=
result
;
this
.
result
=
result
;
this
.
eventId
=
eventId
;
this
.
eventId
=
eventId
;
}
}
public
String
getResult
()
{
public
String
getResult
()
{
...
...
app/src/main/java/in/ac/iitb/gymkhana/iitbapp/api/model/LoginResponse.java
View file @
67138833
package
in.ac.iitb.gymkhana.iitbapp.api.model
;
package
in.ac.iitb.gymkhana.iitbapp.api.model
;
import
com.google.gson.annotations.SerializedName
;
import
com.google.gson.annotations.SerializedName
;
import
in.ac.iitb.gymkhana.iitbapp.data.User
;
import
in.ac.iitb.gymkhana.iitbapp.data.User
;
public
class
LoginResponse
{
public
class
LoginResponse
{
...
...
app/src/main/java/in/ac/iitb/gymkhana/iitbapp/data/AppDatabase.java
View file @
67138833
...
@@ -10,14 +10,12 @@ import android.content.Context;
...
@@ -10,14 +10,12 @@ import android.content.Context;
* Created by mrunz on 14/3/18.
* Created by mrunz on 14/3/18.
*/
*/
@Database
(
entities
=
{
Event
.
class
,
Body
.
class
,
Venue
.
class
},
version
=
1
)
@Database
(
entities
=
{
Event
.
class
,
Body
.
class
,
Venue
.
class
},
version
=
1
)
@TypeConverters
({
Converters
.
class
})
@TypeConverters
({
Converters
.
class
})
public
abstract
class
AppDatabase
extends
RoomDatabase
{
public
abstract
class
AppDatabase
extends
RoomDatabase
{
private
static
AppDatabase
INSTANCE
;
private
static
AppDatabase
INSTANCE
;
public
abstract
DbDao
dbDao
();
public
static
AppDatabase
getAppDatabase
(
Context
context
)
{
public
static
AppDatabase
getAppDatabase
(
Context
context
)
{
if
(
INSTANCE
==
null
)
{
if
(
INSTANCE
==
null
)
{
INSTANCE
=
INSTANCE
=
...
@@ -33,4 +31,6 @@ public abstract class AppDatabase extends RoomDatabase {
...
@@ -33,4 +31,6 @@ public abstract class AppDatabase extends RoomDatabase {
public
static
void
destroyInstance
()
{
public
static
void
destroyInstance
()
{
INSTANCE
=
null
;
INSTANCE
=
null
;
}
}
public
abstract
DbDao
dbDao
();
}
}
app/src/main/java/in/ac/iitb/gymkhana/iitbapp/data/Converters.java
View file @
67138833
...
@@ -7,8 +7,6 @@ import com.google.gson.reflect.TypeToken;
...
@@ -7,8 +7,6 @@ import com.google.gson.reflect.TypeToken;
import
java.lang.reflect.Type
;
import
java.lang.reflect.Type
;
import
java.sql.Timestamp
;
import
java.sql.Timestamp
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.List
;
/**
/**
...
@@ -18,7 +16,8 @@ import java.util.List;
...
@@ -18,7 +16,8 @@ import java.util.List;
public
class
Converters
{
public
class
Converters
{
@TypeConverter
@TypeConverter
public
static
List
<
Event
>
eventsfromString
(
String
value
)
{
public
static
List
<
Event
>
eventsfromString
(
String
value
)
{
Type
listType
=
new
TypeToken
<
List
<
Event
>>()
{}.
getType
();
Type
listType
=
new
TypeToken
<
List
<
Event
>>()
{
}.
getType
();
return
new
Gson
().
fromJson
(
value
,
listType
);
return
new
Gson
().
fromJson
(
value
,
listType
);
}
}
...
@@ -31,7 +30,8 @@ public class Converters {
...
@@ -31,7 +30,8 @@ public class Converters {
@TypeConverter
@TypeConverter
public
static
List
<
User
>
usersfromString
(
String
value
)
{
public
static
List
<
User
>
usersfromString
(
String
value
)
{
Type
listType
=
new
TypeToken
<
List
<
User
>>()
{}.
getType
();
Type
listType
=
new
TypeToken
<
List
<
User
>>()
{
}.
getType
();
return
new
Gson
().
fromJson
(
value
,
listType
);
return
new
Gson
().
fromJson
(
value
,
listType
);
}
}
...
@@ -41,9 +41,11 @@ public class Converters {
...
@@ -41,9 +41,11 @@ public class Converters {
String
json
=
gson
.
toJson
(
list
);
String
json
=
gson
.
toJson
(
list
);
return
json
;
return
json
;
}
}
@TypeConverter
@TypeConverter
public
static
List
<
Venue
>
venuesfromString
(
String
value
)
{
public
static
List
<
Venue
>
venuesfromString
(
String
value
)
{
Type
listType
=
new
TypeToken
<
List
<
Venue
>>()
{}.
getType
();
Type
listType
=
new
TypeToken
<
List
<
Venue
>>()
{
}.
getType
();
return
new
Gson
().
fromJson
(
value
,
listType
);
return
new
Gson
().
fromJson
(
value
,
listType
);
}
}
...
@@ -53,9 +55,11 @@ public class Converters {
...
@@ -53,9 +55,11 @@ public class Converters {
String
json
=
gson
.
toJson
(
list
);
String
json
=
gson
.
toJson
(
list
);
return
json
;
return
json
;
}
}
@TypeConverter
@TypeConverter
public
static
List
<
Body
>
bodiesfromString
(
String
value
)
{
public
static
List
<
Body
>
bodiesfromString
(
String
value
)
{
Type
listType
=
new
TypeToken
<
List
<
Body
>>()
{}.
getType
();
Type
listType
=
new
TypeToken
<
List
<
Body
>>()
{
}.
getType
();
return
new
Gson
().
fromJson
(
value
,
listType
);
return
new
Gson
().
fromJson
(
value
,
listType
);
}
}
...
...
app/src/main/java/in/ac/iitb/gymkhana/iitbapp/data/DbDao.java
View file @
67138833
...
@@ -7,8 +7,6 @@ import android.arch.persistence.room.Query;
...
@@ -7,8 +7,6 @@ import android.arch.persistence.room.Query;
import
java.util.List
;
import
java.util.List
;
import
retrofit2.http.DELETE
;
/**
/**
* Created by mrunz on 13/3/18.
* Created by mrunz on 13/3/18.
*/
*/
...
...
app/src/main/java/in/ac/iitb/gymkhana/iitbapp/data/User.java
View file @
67138833
...
@@ -10,8 +10,6 @@ import com.google.gson.annotations.SerializedName;
...
@@ -10,8 +10,6 @@ import com.google.gson.annotations.SerializedName;
import
java.util.List
;
import
java.util.List
;
import
static
android
.
content
.
ContentValues
.
TAG
;
@Entity
(
tableName
=
"users"
)
@Entity
(
tableName
=
"users"
)
public
class
User
{
public
class
User
{
@PrimaryKey
(
autoGenerate
=
true
)
@PrimaryKey
(
autoGenerate
=
true
)
...
@@ -69,6 +67,10 @@ public class User {
...
@@ -69,6 +67,10 @@ public class User {
this
.
userFollowedBodiesID
=
userFollowedBodiesID
;
this
.
userFollowedBodiesID
=
userFollowedBodiesID
;
}
}
public
static
User
fromString
(
String
json
)
{
return
new
Gson
().
fromJson
(
json
,
User
.
class
);
}
public
String
getUserID
()
{
public
String
getUserID
()
{
return
userID
;
return
userID
;
}
}
...
@@ -169,9 +171,4 @@ public class User {
...
@@ -169,9 +171,4 @@ public class User {
public
String
toString
()
{
public
String
toString
()
{
return
new
Gson
().
toJson
(
this
);
return
new
Gson
().
toJson
(
this
);
}
}
public
static
User
fromString
(
String
json
)
{
Log
.
d
(
TAG
,
"fromString: "
+
json
);
return
new
Gson
().
fromJson
(
json
,
User
.
class
);
}
}
}
app/src/main/java/in/ac/iitb/gymkhana/iitbapp/fragment/AddEventFragment.java
View file @
67138833
...
@@ -13,7 +13,6 @@ import android.net.Uri;
...
@@ -13,7 +13,6 @@ import android.net.Uri;
import
android.os.Bundle
;
import
android.os.Bundle
;
import
android.provider.MediaStore
;
import
android.provider.MediaStore
;
import
android.support.v4.app.ActivityCompat
;
import
android.support.v4.app.ActivityCompat
;
import
android.support.v4.app.Fragment
;
import
android.support.v4.content.ContextCompat
;
import
android.support.v4.content.ContextCompat
;
import
android.util.Base64
;
import
android.util.Base64
;
import
android.util.Log
;
import
android.util.Log
;
...
@@ -38,6 +37,7 @@ import java.util.Calendar;
...
@@ -38,6 +37,7 @@ import java.util.Calendar;
import
butterknife.BindView
;
import
butterknife.BindView
;
import
butterknife.ButterKnife
;
import
butterknife.ButterKnife
;
import
in.ac.iitb.gymkhana.iitbapp.Constants
;
import
in.ac.iitb.gymkhana.iitbapp.R
;
import
in.ac.iitb.gymkhana.iitbapp.R
;
import
in.ac.iitb.gymkhana.iitbapp.api.RetrofitInterface
;
import
in.ac.iitb.gymkhana.iitbapp.api.RetrofitInterface
;
import
in.ac.iitb.gymkhana.iitbapp.api.ServiceGenerator
;
import
in.ac.iitb.gymkhana.iitbapp.api.ServiceGenerator
;
...
@@ -50,10 +50,8 @@ import retrofit2.Callback;
...
@@ -50,10 +50,8 @@ import retrofit2.Callback;
import
retrofit2.Response
;
import
retrofit2.Response
;
import
static
android
.
app
.
Activity
.
RESULT_OK
;
import
static
android
.
app
.
Activity
.
RESULT_OK
;
import
static
android
.
content
.
ContentValues
.
TAG
;
import
static
in
.
ac
.
iitb
.
gymkhana
.
iitbapp
.
Constants
.
MY_PERMISSIONS_REQUEST_READ_EXTERNAL_STORAGE
;
import
static
in
.
ac
.
iitb
.
gymkhana
.
iitbapp
.
Constants
.
MY_PERMISSIONS_REQUEST_READ_EXTERNAL_STORAGE
;
import
static
in
.
ac
.
iitb
.
gymkhana
.
iitbapp
.
Constants
.
RESULT_LOAD_IMAGE
;
import
static
in
.
ac
.
iitb
.
gymkhana
.
iitbapp
.
Constants
.
RESULT_LOAD_IMAGE
;
import
static
in
.
ac
.
iitb
.
gymkhana
.
iitbapp
.
SessionManager
.
SESSION_ID
;
public
class
AddEventFragment
extends
BaseFragment
{
public
class
AddEventFragment
extends
BaseFragment
{
...
@@ -93,12 +91,23 @@ public class AddEventFragment extends BaseFragment {
...
@@ -93,12 +91,23 @@ public class AddEventFragment extends BaseFragment {
View
view
;
View
view
;
String
base64Image
;
String
base64Image
;
ProgressDialog
progressDialog
;
ProgressDialog
progressDialog
;
String
TAG
=
"AddEventFragment"
;
public
AddEventFragment
()
{
public
AddEventFragment
()
{
// Required empty public constructor
// Required empty public constructor
}
}
public
static
String
convertImageToString
(
Bitmap
imageBitmap
)
{
ByteArrayOutputStream
stream
=
new
ByteArrayOutputStream
();
if
(
imageBitmap
!=
null
)
{
imageBitmap
.
compress
(
Bitmap
.
CompressFormat
.
JPEG
,
60
,
stream
);
byte
[]
byteArray
=
stream
.
toByteArray
();
return
Base64
.
encodeToString
(
byteArray
,
Base64
.
DEFAULT
);
}
else
{
return
null
;
}
}
@Override
@Override
public
View
onCreateView
(
LayoutInflater
inflater
,
ViewGroup
container
,
public
View
onCreateView
(
LayoutInflater
inflater
,
ViewGroup
container
,
...
@@ -243,7 +252,7 @@ public class AddEventFragment extends BaseFragment {
...
@@ -243,7 +252,7 @@ public class AddEventFragment extends BaseFragment {
progressDialog
.
setMessage
(
"Uploading Image"
);
progressDialog
.
setMessage
(
"Uploading Image"
);
ImageUploadRequest
imageUploadRequest
=
new
ImageUploadRequest
(
base64Image
);
ImageUploadRequest
imageUploadRequest
=
new
ImageUploadRequest
(
base64Image
);
RetrofitInterface
retrofitInterface
=
ServiceGenerator
.
createService
(
RetrofitInterface
.
class
);
RetrofitInterface
retrofitInterface
=
ServiceGenerator
.
createService
(
RetrofitInterface
.
class
);
retrofitInterface
.
uploadImage
(
"sessionid="
+
getArguments
().
getString
(
SESSION_ID
),
imageUploadRequest
).
enqueue
(
new
Callback
<
ImageUploadResponse
>()
{
retrofitInterface
.
uploadImage
(
"sessionid="
+
getArguments
().
getString
(
Constants
.
SESSION_ID
),
imageUploadRequest
).
enqueue
(
new
Callback
<
ImageUploadResponse
>()
{
@Override
@Override
public
void
onResponse
(
Call
<
ImageUploadResponse
>
call
,
Response
<
ImageUploadResponse
>
response
)
{
public
void
onResponse
(
Call
<
ImageUploadResponse
>
call
,
Response
<
ImageUploadResponse
>
response
)
{
if
(
response
.
isSuccessful
())
{
if
(
response
.
isSuccessful
())
{
...
@@ -264,7 +273,7 @@ public class AddEventFragment extends BaseFragment {
...
@@ -264,7 +273,7 @@ public class AddEventFragment extends BaseFragment {
progressDialog
.
setMessage
(
"Creating Event"
);
progressDialog
.
setMessage
(
"Creating Event"
);
EventCreateRequest
eventCreateRequest
=
new
EventCreateRequest
(
eventName
.
getText
().
toString
(),
details
.
getText
().
toString
(),
eventImageURL
,
timestamp_start
.
toString
(),
timestamp_end
.
toString
(),
false
,
Arrays
.
asList
(
new
String
[]{
venue
.
getText
().
toString
()}),
Arrays
.
asList
(
new
String
[]{
"bde82d5e-f379-4b8a-ae38-a9f03e4f1c4a"
}));
EventCreateRequest
eventCreateRequest
=
new
EventCreateRequest
(
eventName
.
getText
().
toString
(),
details
.
getText
().
toString
(),
eventImageURL
,
timestamp_start
.
toString
(),
timestamp_end
.
toString
(),
false
,
Arrays
.
asList
(
new
String
[]{
venue
.
getText
().
toString
()}),
Arrays
.
asList
(
new
String
[]{
"bde82d5e-f379-4b8a-ae38-a9f03e4f1c4a"
}));
RetrofitInterface
retrofitInterface
=
ServiceGenerator
.
createService
(
RetrofitInterface
.
class
);
RetrofitInterface
retrofitInterface
=
ServiceGenerator
.
createService
(
RetrofitInterface
.
class
);
retrofitInterface
.
createEvent
(
"sessionid="
+
getArguments
().
getString
(
SESSION_ID
),
eventCreateRequest
).
enqueue
(
new
Callback
<
EventCreateResponse
>()
{
retrofitInterface
.
createEvent
(
"sessionid="
+
getArguments
().
getString
(
Constants
.
SESSION_ID
),
eventCreateRequest
).
enqueue
(
new
Callback
<
EventCreateResponse
>()
{
@Override
@Override
public
void
onResponse
(
Call
<
EventCreateResponse
>
call
,
Response
<
EventCreateResponse
>
response
)
{
public
void
onResponse
(
Call
<
EventCreateResponse
>
call
,
Response
<
EventCreateResponse
>
response
)
{
Toast
.
makeText
(
getContext
(),
"Event Created"
,
Toast
.
LENGTH_SHORT
).
show
();
Toast
.
makeText
(
getContext
(),
"Event Created"
,
Toast
.
LENGTH_SHORT
).
show
();
...
@@ -279,17 +288,6 @@ public class AddEventFragment extends BaseFragment {
...
@@ -279,17 +288,6 @@ public class AddEventFragment extends BaseFragment {
});
});
}
}
public
static
String
convertImageToString
(
Bitmap
imageBitmap
)
{
ByteArrayOutputStream
stream
=
new
ByteArrayOutputStream
();
if
(
imageBitmap
!=
null
)
{
imageBitmap
.
compress
(
Bitmap
.
CompressFormat
.
JPEG
,
60
,
stream
);
byte
[]
byteArray
=
stream
.
toByteArray
();
return
Base64
.
encodeToString
(
byteArray
,
Base64
.
DEFAULT
);
}
else
{
return
null
;
}
}
@Override
@Override
public
void
onActivityResult
(
int
requestCode
,
int
resultCode
,
Intent
data
)
{
public
void
onActivityResult
(
int
requestCode
,
int
resultCode
,
Intent
data
)
{
super
.
onActivityResult
(
requestCode
,
resultCode
,
data
);
super
.
onActivityResult
(
requestCode
,
resultCode
,
data
);
...
...
app/src/main/java/in/ac/iitb/gymkhana/iitbapp/fragment/BaseFragment.java
View file @
67138833
...
@@ -3,16 +3,9 @@ package in.ac.iitb.gymkhana.iitbapp.fragment;
...
@@ -3,16 +3,9 @@ package in.ac.iitb.gymkhana.iitbapp.fragment;
import
android.app.Activity
;
import
android.app.Activity
;
import
android.content.Context
;
import
android.content.Context
;
import
android.os.Bundle
;
import
android.support.v4.app.Fragment
;
import
android.support.v4.app.Fragment
;
import
android.support.v4.app.FragmentActivity
;
import
android.view.LayoutInflater
;
import
android.view.View
;
import
android.view.ViewGroup
;
import
android.widget.TextView
;
import
in.ac.iitb.gymkhana.iitbapp.ActivityBuffer
;
import
in.ac.iitb.gymkhana.iitbapp.ActivityBuffer
;
import
in.ac.iitb.gymkhana.iitbapp.R
;
/**
/**
* A simple {@link Fragment} subclass.
* A simple {@link Fragment} subclass.
...
@@ -34,15 +27,16 @@ public class BaseFragment extends Fragment {
...
@@ -34,15 +27,16 @@ public class BaseFragment extends Fragment {
// Handle as usual.
// Handle as usual.
super
.
onAttach
(
pContext
);
super
.
onAttach
(
pContext
);
// Is the Context an Activity?
// Is the Context an Activity?
if
(
pContext
instanceof
Activity
)
{
if
(
pContext
instanceof
Activity
)
{
// Cast Accordingly.
// Cast Accordingly.
final
Activity
lActivity
=
(
Activity
)
pContext
;
final
Activity
lActivity
=
(
Activity
)
pContext
;
// Inform the ActivityBuffer.
// Inform the ActivityBuffer.
this
.
getActivityBuffer
().
onContextGained
(
lActivity
);
this
.
getActivityBuffer
().
onContextGained
(
lActivity
);
}
}
}
}
@Deprecated
@Override
@Deprecated
@Override
public
final
void
onAttach
(
final
Activity
pActivity
)
{
public
final
void
onAttach
(
final
Activity
pActivity
)
{
// Handle as usual.
// Handle as usual.
super
.
onAttach
(
pActivity
);
super
.
onAttach
(
pActivity
);
...
...
app/src/main/java/in/ac/iitb/gymkhana/iitbapp/fragment/EventFragment.java
View file @
67138833
...
@@ -29,9 +29,6 @@ import retrofit2.Call;
...
@@ -29,9 +29,6 @@ import retrofit2.Call;
import
retrofit2.Callback
;
import
retrofit2.Callback
;
import
retrofit2.Response
;
import
retrofit2.Response
;
import
static
android
.
content
.
ContentValues
.
TAG
;
import
static
in
.
ac
.
iitb
.
gymkhana
.
iitbapp
.
SessionManager
.
SESSION_ID
;
/**
/**
* A simple {@link Fragment} subclass.
* A simple {@link Fragment} subclass.
*/
*/
...
@@ -40,6 +37,7 @@ public class EventFragment extends BaseFragment implements View.OnClickListener
...
@@ -40,6 +37,7 @@ public class EventFragment extends BaseFragment implements View.OnClickListener
Button
goingButton
;
Button
goingButton
;
Button
interestedButton
;
Button
interestedButton
;
Button
notGoingButton
;
Button
notGoingButton
;
String
TAG
=
"EventFragment"
;
public
EventFragment
()
{
public
EventFragment
()
{
// Required empty public constructor
// Required empty public constructor
...
@@ -115,7 +113,7 @@ public class EventFragment extends BaseFragment implements View.OnClickListener
...
@@ -115,7 +113,7 @@ public class EventFragment extends BaseFragment implements View.OnClickListener
break
;
break
;
}
}
RetrofitInterface
retrofitInterface
=
ServiceGenerator
.
createService
(
RetrofitInterface
.
class
);
RetrofitInterface
retrofitInterface
=
ServiceGenerator
.
createService
(
RetrofitInterface
.
class
);
retrofitInterface
.
updateUserEventStatus
(
"sessionid="
+
getArguments
().
getString
(
SESSION_ID
),
event
.
getEventID
(),
status
).
enqueue
(
new
Callback
<
Void
>()
{
retrofitInterface
.
updateUserEventStatus
(
"sessionid="
+
getArguments
().
getString
(
Constants
.
SESSION_ID
),
event
.
getEventID
(),
status
).
enqueue
(
new
Callback
<
Void
>()
{
@Override
@Override
public
void
onResponse
(
Call
<
Void
>
call
,
Response
<
Void
>
response
)
{
public
void
onResponse
(
Call
<
Void
>
call
,
Response
<
Void
>
response
)
{
if
(
response
.
isSuccessful
())
{
if
(
response
.
isSuccessful
())
{
...
...
app/src/main/java/in/ac/iitb/gymkhana/iitbapp/fragment/FeedFragment.java
View file @
67138833
...
@@ -32,8 +32,6 @@ import retrofit2.Call;
...
@@ -32,8 +32,6 @@ import retrofit2.Call;
import
retrofit2.Callback
;
import
retrofit2.Callback
;
import
retrofit2.Response
;
import
retrofit2.Response
;
import
static
in
.
ac
.
iitb
.
gymkhana
.
iitbapp
.
SessionManager
.
SESSION_ID
;
/**
/**
* A simple {@link Fragment} subclass.
* A simple {@link Fragment} subclass.
*/
*/
...
@@ -54,9 +52,9 @@ public class FeedFragment extends BaseFragment {
...
@@ -54,9 +52,9 @@ public class FeedFragment extends BaseFragment {
Bundle
savedInstanceState
)
{
Bundle
savedInstanceState
)
{
// Inflate the layout for this fragment
// Inflate the layout for this fragment
View
view
=
inflater
.
inflate
(
R
.
layout
.
fragment_feed
,
container
,
false
);
View
view
=
inflater
.
inflate
(
R
.
layout
.
fragment_feed
,
container
,
false
);
fab
=
(
FloatingActionButton
)
view
.
findViewById
(
R
.
id
.
fab
);
fab
=
(
FloatingActionButton
)
view
.
findViewById
(
R
.
id
.
fab
);
fab
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
fab
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
@Override
...
@@ -93,7 +91,7 @@ public class FeedFragment extends BaseFragment {
...
@@ -93,7 +91,7 @@ public class FeedFragment extends BaseFragment {
private
void
updateFeed
()
{
private
void
updateFeed
()
{
RetrofitInterface
retrofitInterface
=
ServiceGenerator
.
createService
(
RetrofitInterface
.
class
);
RetrofitInterface
retrofitInterface
=
ServiceGenerator
.
createService
(
RetrofitInterface
.
class
);
retrofitInterface
.
getNewsFeed
(
"sessionid="
+
getArguments
().
getString
(
SESSION_ID
)).
enqueue
(
new
Callback
<
NewsFeedResponse
>()
{
retrofitInterface
.
getNewsFeed
(
"sessionid="
+
getArguments
().
getString
(
Constants
.
SESSION_ID
)).
enqueue
(
new
Callback
<
NewsFeedResponse
>()
{
@Override
@Override
public
void
onResponse
(
Call
<
NewsFeedResponse
>
call
,
Response
<
NewsFeedResponse
>
response
)
{
public
void
onResponse
(
Call
<
NewsFeedResponse
>
call
,
Response
<
NewsFeedResponse
>
response
)
{
if
(
response
.
isSuccessful
())
{
if
(
response
.
isSuccessful
())
{
...
...
app/src/main/java/in/ac/iitb/gymkhana/iitbapp/fragment/MapFragment.java
View file @
67138833
...
@@ -4,7 +4,6 @@ import android.Manifest;
...
@@ -4,7 +4,6 @@ import android.Manifest;
import
android.app.AlertDialog
;
import
android.app.AlertDialog
;
import
android.content.Context
;
import
android.content.Context
;
import
android.content.DialogInterface
;
import
android.content.DialogInterface
;
import
android.content.Intent
;
import
android.content.IntentSender
;
import
android.content.IntentSender
;
import
android.content.pm.PackageManager
;
import
android.content.pm.PackageManager
;
import
android.content.res.ColorStateList
;
import
android.content.res.ColorStateList
;
...
@@ -12,13 +11,10 @@ import android.graphics.Color;
...
@@ -12,13 +11,10 @@ import android.graphics.Color;
import
android.graphics.PorterDuff
;
import
android.graphics.PorterDuff
;
import
android.location.Location
;
import
android.location.Location
;
import
android.location.LocationManager
;
import
android.location.LocationManager
;
import
android.net.Uri
;
import
android.os.Build
;
import
android.os.Build
;
import
android.os.Bundle
;
import
android.os.Bundle
;
import
android.provider.Settings
;
import
android.support.design.widget.FloatingActionButton
;
import
android.support.design.widget.FloatingActionButton
;
import
android.support.v4.app.ActivityCompat
;
import
android.support.v4.app.ActivityCompat
;
import
android.support.v4.app.Fragment
;
import
android.support.v4.content.ContextCompat
;
import
android.support.v4.content.ContextCompat
;
import
android.util.Log
;
import
android.util.Log
;
import
android.view.LayoutInflater
;
import
android.view.LayoutInflater
;
...
@@ -50,6 +46,7 @@ import com.google.android.gms.maps.model.MarkerOptions;
...
@@ -50,6 +46,7 @@ import com.google.android.gms.maps.model.MarkerOptions;
import
java.util.List
;
import
java.util.List
;
import
in.ac.iitb.gymkhana.iitbapp.Constants
;
import
in.ac.iitb.gymkhana.iitbapp.R
;
import
in.ac.iitb.gymkhana.iitbapp.R
;
import
static
android
.
content
.
Context
.
LOCATION_SERVICE
;
import
static
android
.
content
.
Context
.
LOCATION_SERVICE
;
...
@@ -65,7 +62,6 @@ public class MapFragment extends BaseFragment implements OnMapReadyCallback, Loc
...
@@ -65,7 +62,6 @@ public class MapFragment extends BaseFragment implements OnMapReadyCallback, Loc
LocationRequest
mLocationRequest
;
LocationRequest
mLocationRequest
;
private
FloatingActionButton
locationButton
;
private
FloatingActionButton
locationButton
;
private
Location
currentLocation
;
private
Location
currentLocation
;
public
static
final
int
MY_PERMISSIONS_REQUEST_LOCATION
=
99
;
public
View
onCreateView
(
LayoutInflater
inflater
,
ViewGroup
container
,
public
View
onCreateView
(
LayoutInflater
inflater
,
ViewGroup
container
,
Bundle
savedInstanceState
)
{
Bundle
savedInstanceState
)
{
...
@@ -77,8 +73,9 @@ public class MapFragment extends BaseFragment implements OnMapReadyCallback, Loc
...
@@ -77,8 +73,9 @@ public class MapFragment extends BaseFragment implements OnMapReadyCallback, Loc
return
view
;
return
view
;
}
}
@Override
@Override
public
void
onStart
(){
public
void
onStart
()
{
super
.
onStart
();
super
.
onStart
();
locationButton
=
(
FloatingActionButton
)
getActivity
().
findViewById
(
R
.
id
.
location_button
);
locationButton
=
(
FloatingActionButton
)
getActivity
().
findViewById
(
R
.
id
.
location_button
);
locationButton
.
setImageResource
(
R
.
drawable
.
ic_my_location_black_24dp
);
locationButton
.
setImageResource
(
R
.
drawable
.
ic_my_location_black_24dp
);
...
@@ -87,7 +84,7 @@ public class MapFragment extends BaseFragment implements OnMapReadyCallback, Loc
...
@@ -87,7 +84,7 @@ public class MapFragment extends BaseFragment implements OnMapReadyCallback, Loc
locationButton
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
locationButton
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
@Override
public
void
onClick
(
View
v
)
{
public
void
onClick
(
View
v
)
{
Log
.
v
(
"MapFragment"
,
"Location button pressed"
);
Log
.
v
(
"MapFragment"
,
"Location button pressed"
);
try
{
try
{
LocationManager
lm
=
(
LocationManager
)
getContext
().
getSystemService
(
Context
.
LOCATION_SERVICE
);
LocationManager
lm
=
(
LocationManager
)
getContext
().
getSystemService
(
Context
.
LOCATION_SERVICE
);
...
@@ -95,19 +92,21 @@ public class MapFragment extends BaseFragment implements OnMapReadyCallback, Loc
...
@@ -95,19 +92,21 @@ public class MapFragment extends BaseFragment implements OnMapReadyCallback, Loc
boolean
network_enabled
=
false
;
boolean
network_enabled
=
false
;
if
(
ActivityCompat
.
checkSelfPermission
(
getActivity
(),
android
.
Manifest
.
permission
.
ACCESS_FINE_LOCATION
)
!=
PackageManager
.
PERMISSION_GRANTED
&&
ActivityCompat
.
checkSelfPermission
(
getContext
(),
android
.
Manifest
.
permission
.
ACCESS_COARSE_LOCATION
)
!=
PackageManager
.
PERMISSION_GRANTED
)
{
if
(
ActivityCompat
.
checkSelfPermission
(
getActivity
(),
android
.
Manifest
.
permission
.
ACCESS_FINE_LOCATION
)
!=
PackageManager
.
PERMISSION_GRANTED
&&
ActivityCompat
.
checkSelfPermission
(
getContext
(),
android
.
Manifest
.
permission
.
ACCESS_COARSE_LOCATION
)
!=
PackageManager
.
PERMISSION_GRANTED
)
{
ActivityCompat
.
requestPermissions
(
getActivity
(),
new
String
[]{
Manifest
.
permission
.
ACCESS_COARSE_LOCATION
},
MY_PERMISSIONS_REQUEST_LOCATION
);
ActivityCompat
.
requestPermissions
(
getActivity
(),
new
String
[]{
Manifest
.
permission
.
ACCESS_COARSE_LOCATION
},
Constants
.
MY_PERMISSIONS_REQUEST_LOCATION
);
return
;
return
;
}
}
try
{
try
{
gps_enabled
=
lm
.
isProviderEnabled
(
LocationManager
.
GPS_PROVIDER
);
gps_enabled
=
lm
.
isProviderEnabled
(
LocationManager
.
GPS_PROVIDER
);
}
catch
(
Exception
ex
)
{}
}
catch
(
Exception
ex
)
{
}
try
{
try
{
network_enabled
=
lm
.
isProviderEnabled
(
LocationManager
.
NETWORK_PROVIDER
);
network_enabled
=
lm
.
isProviderEnabled
(
LocationManager
.
NETWORK_PROVIDER
);
}
catch
(
Exception
ex
)
{}
}
catch
(
Exception
ex
)
{
}
if
(!
gps_enabled
&&
!
network_enabled
)
{
if
(!
gps_enabled
&&
!
network_enabled
)
{
LocationRequest
locationRequest
=
LocationRequest
.
create
();
LocationRequest
locationRequest
=
LocationRequest
.
create
();
...
@@ -163,7 +162,7 @@ public class MapFragment extends BaseFragment implements OnMapReadyCallback, Loc
...
@@ -163,7 +162,7 @@ public class MapFragment extends BaseFragment implements OnMapReadyCallback, Loc
}
}
}
catch
(
Exception
e
){
}
catch
(
Exception
e
)
{
checkLocationPermission
();
checkLocationPermission
();
Toast
.
makeText
(
getContext
(),
"Please turn on Location from the Settings"
,
Toast
.
LENGTH_SHORT
).
show
();
Toast
.
makeText
(
getContext
(),
"Please turn on Location from the Settings"
,
Toast
.
LENGTH_SHORT
).
show
();
...
@@ -188,7 +187,7 @@ public class MapFragment extends BaseFragment implements OnMapReadyCallback, Loc
...
@@ -188,7 +187,7 @@ public class MapFragment extends BaseFragment implements OnMapReadyCallback, Loc
ActivityCompat
.
requestPermissions
(
getActivity
(),
new
String
[]{
android
.
Manifest
.
permission
.
ACCESS_COARSE_LOCATION
},
ActivityCompat
.
requestPermissions
(
getActivity
(),
new
String
[]{
android
.
Manifest
.
permission
.
ACCESS_COARSE_LOCATION
},
MY_PERMISSIONS_REQUEST_LOCATION
);
Constants
.
MY_PERMISSIONS_REQUEST_LOCATION
);
}
}
//Get the last known location from the data provider
//Get the last known location from the data provider
Location
l
=
mLocationManager
.
getLastKnownLocation
(
provider
);
Location
l
=
mLocationManager
.
getLastKnownLocation
(
provider
);
...
@@ -263,7 +262,7 @@ public class MapFragment extends BaseFragment implements OnMapReadyCallback, Loc
...
@@ -263,7 +262,7 @@ public class MapFragment extends BaseFragment implements OnMapReadyCallback, Loc
public
void
onClick
(
DialogInterface
dialogInterface
,
int
i
)
{
public
void
onClick
(
DialogInterface
dialogInterface
,
int
i
)
{
//Prompt the user once explanation has been shown
//Prompt the user once explanation has been shown
requestPermissions
(
new
String
[]{
Manifest
.
permission
.
ACCESS_FINE_LOCATION
},
requestPermissions
(
new
String
[]{
Manifest
.
permission
.
ACCESS_FINE_LOCATION
},
MY_PERMISSIONS_REQUEST_LOCATION
);
Constants
.
MY_PERMISSIONS_REQUEST_LOCATION
);
}
}
})
})
...
@@ -274,7 +273,7 @@ public class MapFragment extends BaseFragment implements OnMapReadyCallback, Loc
...
@@ -274,7 +273,7 @@ public class MapFragment extends BaseFragment implements OnMapReadyCallback, Loc
}
else
{
}
else
{
// No explanation needed, we can request the permission.
// No explanation needed, we can request the permission.
requestPermissions
(
new
String
[]{
Manifest
.
permission
.
ACCESS_FINE_LOCATION
},
requestPermissions
(
new
String
[]{
Manifest
.
permission
.
ACCESS_FINE_LOCATION
},
MY_PERMISSIONS_REQUEST_LOCATION
);
Constants
.
MY_PERMISSIONS_REQUEST_LOCATION
);
}
}
}
}
}
}
...
@@ -287,6 +286,7 @@ public class MapFragment extends BaseFragment implements OnMapReadyCallback, Loc
...
@@ -287,6 +286,7 @@ public class MapFragment extends BaseFragment implements OnMapReadyCallback, Loc
.
build
();
.
build
();
mGoogleApiClient
.
connect
();
mGoogleApiClient
.
connect
();
}
}
@Override
@Override
public
void
onLocationChanged
(
Location
location
)
{
public
void
onLocationChanged
(
Location
location
)
{
mLastLocation
=
location
;
mLastLocation
=
location
;
...
@@ -298,13 +298,14 @@ public class MapFragment extends BaseFragment implements OnMapReadyCallback, Loc
...
@@ -298,13 +298,14 @@ public class MapFragment extends BaseFragment implements OnMapReadyCallback, Loc
LatLng
latLng
=
new
LatLng
(
location
.
getLatitude
(),
location
.
getLongitude
());
LatLng
latLng
=
new
LatLng
(
location
.
getLatitude
(),
location
.
getLongitude
());
//move map camera
//move map camera
googleMap
.
moveCamera
(
CameraUpdateFactory
.
newLatLng
(
latLng
));
googleMap
.
moveCamera
(
CameraUpdateFactory
.
newLatLng
(
latLng
));
googleMap
.
animateCamera
(
CameraUpdateFactory
.
zoomTo
(
17
));
googleMap
.
animateCamera
(
CameraUpdateFactory
.
zoomTo
(
17
));
//stop location updates
//stop location updates
if
(
mGoogleApiClient
!=
null
)
{
if
(
mGoogleApiClient
!=
null
)
{
LocationServices
.
FusedLocationApi
.
removeLocationUpdates
(
mGoogleApiClient
,
this
);
LocationServices
.
FusedLocationApi
.
removeLocationUpdates
(
mGoogleApiClient
,
this
);
}
}
}
}
@Override
@Override
public
void
onConnectionSuspended
(
int
i
)
{
public
void
onConnectionSuspended
(
int
i
)
{
}
}
...
@@ -313,7 +314,7 @@ public class MapFragment extends BaseFragment implements OnMapReadyCallback, Loc
...
@@ -313,7 +314,7 @@ public class MapFragment extends BaseFragment implements OnMapReadyCallback, Loc
public
void
onRequestPermissionsResult
(
int
requestCode
,
public
void
onRequestPermissionsResult
(
int
requestCode
,
String
permissions
[],
int
[]
grantResults
)
{
String
permissions
[],
int
[]
grantResults
)
{
switch
(
requestCode
)
{
switch
(
requestCode
)
{
case
MY_PERMISSIONS_REQUEST_LOCATION:
{
case
Constants
.
MY_PERMISSIONS_REQUEST_LOCATION
:
{
// If request is cancelled, the result arrays are empty.
// If request is cancelled, the result arrays are empty.
if
(
grantResults
.
length
>
0
&&
grantResults
[
0
]
==
PackageManager
.
PERMISSION_GRANTED
)
{
if
(
grantResults
.
length
>
0
&&
grantResults
[
0
]
==
PackageManager
.
PERMISSION_GRANTED
)
{
if
(
ContextCompat
.
checkSelfPermission
(
getActivity
(),
Manifest
.
permission
.
ACCESS_FINE_LOCATION
)
==
PackageManager
.
PERMISSION_GRANTED
)
{
if
(
ContextCompat
.
checkSelfPermission
(
getActivity
(),
Manifest
.
permission
.
ACCESS_FINE_LOCATION
)
==
PackageManager
.
PERMISSION_GRANTED
)
{
...
@@ -327,6 +328,7 @@ public class MapFragment extends BaseFragment implements OnMapReadyCallback, Loc
...
@@ -327,6 +328,7 @@ public class MapFragment extends BaseFragment implements OnMapReadyCallback, Loc
}
}
}
}
}
}
@Override
@Override
public
void
onConnectionFailed
(
ConnectionResult
connectionResult
)
{
public
void
onConnectionFailed
(
ConnectionResult
connectionResult
)
{
}
}
...
@@ -345,5 +347,4 @@ public class MapFragment extends BaseFragment implements OnMapReadyCallback, Loc
...
@@ -345,5 +347,4 @@ public class MapFragment extends BaseFragment implements OnMapReadyCallback, Loc
}
}
}
}
app/src/main/java/in/ac/iitb/gymkhana/iitbapp/fragment/MyEventsFragment.java
View file @
67138833
...
@@ -27,10 +27,10 @@ public class MyEventsFragment extends BaseFragment {
...
@@ -27,10 +27,10 @@ public class MyEventsFragment extends BaseFragment {
public
View
onCreateView
(
LayoutInflater
inflater
,
ViewGroup
container
,
public
View
onCreateView
(
LayoutInflater
inflater
,
ViewGroup
container
,
Bundle
savedInstanceState
)
{
Bundle
savedInstanceState
)
{
// Inflate the layout for this fragment
// Inflate the layout for this fragment
View
view
=
inflater
.
inflate
(
R
.
layout
.
fragment_my_events
,
container
,
false
);
View
view
=
inflater
.
inflate
(
R
.
layout
.
fragment_my_events
,
container
,
false
);
fab
=
(
FloatingActionButton
)
view
.
findViewById
(
R
.
id
.
fab
);
fab
=
(
FloatingActionButton
)
view
.
findViewById
(
R
.
id
.
fab
);
fab
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
fab
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
@Override
...
...
app/src/main/java/in/ac/iitb/gymkhana/iitbapp/fragment/PeopleFragment.java
View file @
67138833
...
@@ -3,7 +3,6 @@ package in.ac.iitb.gymkhana.iitbapp.fragment;
...
@@ -3,7 +3,6 @@ package in.ac.iitb.gymkhana.iitbapp.fragment;
import
android.app.SearchManager
;
import
android.app.SearchManager
;
import
android.content.Context
;
import
android.content.Context
;
import
android.os.Bundle
;
import
android.os.Bundle
;
import
android.support.v4.app.Fragment
;
import
android.support.v4.view.MenuItemCompat
;
import
android.support.v4.view.MenuItemCompat
;
import
android.support.v7.widget.SearchView
;
import
android.support.v7.widget.SearchView
;
import
android.view.LayoutInflater
;
import
android.view.LayoutInflater
;
...
...
app/src/main/java/in/ac/iitb/gymkhana/iitbapp/fragment/ProfileFragment.java
View file @
67138833
...
@@ -20,8 +20,6 @@ import retrofit2.Call;
...
@@ -20,8 +20,6 @@ import retrofit2.Call;
import
retrofit2.Callback
;
import
retrofit2.Callback
;
import
retrofit2.Response
;
import
retrofit2.Response
;
import
static
in
.
ac
.
iitb
.
gymkhana
.
iitbapp
.
SessionManager
.
SESSION_ID
;
/**
/**
* A simple {@link Fragment} subclass.
* A simple {@link Fragment} subclass.
*/
*/
...
@@ -47,7 +45,7 @@ public class ProfileFragment extends BaseFragment {
...
@@ -47,7 +45,7 @@ public class ProfileFragment extends BaseFragment {
String
userID
=
bundle
.
getString
(
Constants
.
USER_ID
);
String
userID
=
bundle
.
getString
(
Constants
.
USER_ID
);
RetrofitInterface
retrofitInterface
=
ServiceGenerator
.
createService
(
RetrofitInterface
.
class
);
RetrofitInterface
retrofitInterface
=
ServiceGenerator
.
createService
(
RetrofitInterface
.
class
);
retrofitInterface
.
getUser
(
"sessionid="
+
getArguments
().
getString
(
SESSION_ID
),
userID
).
enqueue
(
new
Callback
<
User
>()
{
retrofitInterface
.
getUser
(
"sessionid="
+
getArguments
().
getString
(
Constants
.
SESSION_ID
),
userID
).
enqueue
(
new
Callback
<
User
>()
{
@Override
@Override
public
void
onResponse
(
Call
<
User
>
call
,
Response
<
User
>
response
)
{
public
void
onResponse
(
Call
<
User
>
call
,
Response
<
User
>
response
)
{
if
(
response
.
isSuccessful
())
{
if
(
response
.
isSuccessful
())
{
...
...
app/src/main/java/in/ac/iitb/gymkhana/iitbapp/gcm/RegistrationIntentService.java
View file @
67138833
...
@@ -16,13 +16,11 @@ import android.widget.Toast;
...
@@ -16,13 +16,11 @@ import android.widget.Toast;
import
com.google.android.gms.gcm.GoogleCloudMessaging
;
import
com.google.android.gms.gcm.GoogleCloudMessaging
;
import
com.google.android.gms.iid.InstanceID
;
import
com.google.android.gms.iid.InstanceID
;
import
in.ac.iitb.gymkhana.iitbapp.Constants
;
@TargetApi
(
Build
.
VERSION_CODES
.
CUPCAKE
)
@TargetApi
(
Build
.
VERSION_CODES
.
CUPCAKE
)
public
class
RegistrationIntentService
extends
IntentService
{
public
class
RegistrationIntentService
extends
IntentService
{
public
static
final
String
SENT_TOKEN_TO_SERVER
=
"sentTokenToServer"
;
public
static
final
String
REGISTRATION_COMPLETE
=
"registrationComplete"
;
private
static
final
String
TAG
=
"RegIntentService"
;
private
static
final
String
TAG
=
"RegIntentService"
;
...
@@ -44,15 +42,15 @@ public class RegistrationIntentService extends IntentService {
...
@@ -44,15 +42,15 @@ public class RegistrationIntentService extends IntentService {
Toast
.
makeText
(
this
,
"GCM Registration Token: "
+
token
,
Toast
.
LENGTH_SHORT
).
show
();
Toast
.
makeText
(
this
,
"GCM Registration Token: "
+
token
,
Toast
.
LENGTH_SHORT
).
show
();
sharedPreferences
.
edit
().
putBoolean
(
SENT_TOKEN_TO_SERVER
,
true
).
apply
();
sharedPreferences
.
edit
().
putBoolean
(
Constants
.
SENT_TOKEN_TO_SERVER
,
true
).
apply
();
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
Log
.
d
(
TAG
,
"Failed to complete token refresh"
,
e
);
Log
.
d
(
TAG
,
"Failed to complete token refresh"
,
e
);
sharedPreferences
.
edit
().
putBoolean
(
SENT_TOKEN_TO_SERVER
,
false
).
apply
();
sharedPreferences
.
edit
().
putBoolean
(
Constants
.
SENT_TOKEN_TO_SERVER
,
false
).
apply
();
}
}
//Notify UI that registration is complete
//Notify UI that registration is complete
Intent
registrationComplete
=
new
Intent
(
REGISTRATION_COMPLETE
);
Intent
registrationComplete
=
new
Intent
(
Constants
.
REGISTRATION_COMPLETE
);
registrationComplete
.
putExtra
(
"Token"
,
token
);
registrationComplete
.
putExtra
(
"Token"
,
token
);
LocalBroadcastManager
.
getInstance
(
this
).
sendBroadcast
(
registrationComplete
);
LocalBroadcastManager
.
getInstance
(
this
).
sendBroadcast
(
registrationComplete
);
}
}
...
...
app/src/main/res/layout/feed_card.xml
View file @
67138833
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.CardView
<android.support.v7.widget.CardView
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:card_view=
"http://schemas.android.com/apk/res-auto"
xmlns:card_view=
"http://schemas.android.com/apk/res-auto"
android:layout_height=
"wrap_content"
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
card_view:cardElevation=
"4dp"
android:layout_height=
"wrap_content"
card_view:cardCornerRadius=
"4dp"
android:layout_marginTop=
"4dp"
android:layout_marginBottom=
"4dp"
android:layout_marginBottom=
"4dp"
android:layout_marginLeft=
"8dp"
android:layout_marginRight=
"8dp"
android:layout_marginRight=
"8dp"
android:layout_marginLeft=
"8dp"
>
android:layout_marginTop=
"4dp"
<LinearLayout
card_view:cardCornerRadius=
"4dp"
android:layout_width=
"match_parent"
card_view:cardElevation=
"4dp"
>
android:layout_height=
"wrap_content"
android:orientation=
"vertical"
>
<LinearLayout
<LinearLayout
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"80dp"
android:layout_height=
"wrap_content"
android:orientation=
"horizontal"
>
android:orientation=
"vertical"
>
<ImageView
android:id=
"@+id/event_picture"
android:layout_width=
"80dp"
android:layout_height=
"80dp"
android:layout_gravity=
"center"
android:scaleType=
"centerCrop"
/>
<LinearLayout
<LinearLayout
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_height=
"80dp"
android:layout_weight=
"3"
android:orientation=
"horizontal"
>
android:orientation=
"vertical"
android:layout_gravity=
"center_vertical"
<ImageView
android:layout_marginRight=
"12dp"
android:id=
"@+id/event_picture"
android:layout_marginLeft=
"12dp"
>
android:layout_width=
"80dp"
android:layout_height=
"80dp"
<TextView
android:layout_gravity=
"center"
android:id=
"@+id/event_title"
android:scaleType=
"centerCrop"
/>
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:textColor=
"@android:color/black"
android:textSize=
"18sp"
android:text=
"Event Title"
/>
<LinearLayout
<LinearLayout
android:layout_width=
"
wrap_cont
ent"
android:layout_width=
"
match_par
ent"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:orientation=
"horizontal"
>
android:layout_gravity=
"center_vertical"
<TextView
android:layout_marginLeft=
"12dp"
android:layout_width=
"wrap_content"
android:layout_marginRight=
"12dp"
android:layout_height=
"wrap_content"
android:layout_weight=
"3"
android:id=
"@+id/event_date"
android:orientation=
"vertical"
>
android:text=
"26 May"
/>
<TextView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
" | "
android:textSize=
"20dp"
/>
<TextView
<TextView
android:layout_width=
"wrap_content"
android:id=
"@+id/event_title"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:id=
"@+id/event_time"
android:text=
"Event Title"
android:text=
"6:00 PM"
/>
android:textColor=
"@android:color/black"
<TextView
android:textSize=
"18sp"
/>
<LinearLayout
android:layout_width=
"wrap_content"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
" | "
android:orientation=
"horizontal"
>
android:textSize=
"20dp"
/>
<TextView
android:layout_width=
"100dp"
android:layout_height=
"wrap_content"
android:id=
"@+id/event_venue"
android:text=
"LH 101"
android:ellipsize=
"end"
/>
</LinearLayout>
</LinearLayout>
<TextView
android:id=
"@+id/event_date"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"26 May"
/>
<TextView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
" | "
android:textSize=
"20dp"
/>
<!--<ImageView-->
<TextView
android:id=
"@+id/event_time"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"6:00 PM"
/>
<TextView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
" | "
android:textSize=
"20dp"
/>
<TextView
android:id=
"@+id/event_venue"
android:layout_width=
"100dp"
android:layout_height=
"wrap_content"
android:ellipsize=
"end"
android:text=
"LH 101"
/>
</LinearLayout>
</LinearLayout>
<!--<ImageView-->
<!--android:id="@+id/event_enthu"-->
<!--android:id="@+id/event_enthu"-->
<!--android:layout_width="wrap_content"-->
<!--android:layout_width="wrap_content"-->
<!--android:layout_marginRight="20dp"-->
<!--android:layout_marginRight="20dp"-->
...
@@ -86,14 +92,14 @@
...
@@ -86,14 +92,14 @@
<!--android:src="@drawable/ic_action_add"-->
<!--android:src="@drawable/ic_action_add"-->
<!--android:layout_gravity="center_vertical"/>-->
<!--android:layout_gravity="center_vertical"/>-->
</LinearLayout>
</LinearLayout>
<!--<View-->
<!--<View-->
<!--android:layout_width="match_parent"-->
<!--android:layout_width="match_parent"-->
<!--android:layout_height="2dp"-->
<!--android:layout_height="2dp"-->
<!--android:background="#adfff6"-->
<!--android:background="#adfff6"-->
<!--android:layout_marginLeft="16dp"-->
<!--android:layout_marginLeft="16dp"-->
<!--android:layout_marginRight="16dp">-->
<!--android:layout_marginRight="16dp">-->
<!--</View>-->
<!--</View>-->
</LinearLayout>
</LinearLayout>
</android.support.v7.widget.CardView>
</android.support.v7.widget.CardView>
\ No newline at end of file
app/src/main/res/layout/fragment_add_event.xml
View file @
67138833
...
@@ -4,6 +4,7 @@
...
@@ -4,6 +4,7 @@
android:layout_height=
"match_parent"
android:layout_height=
"match_parent"
android:orientation=
"vertical"
android:orientation=
"vertical"
tools:context=
"in.ac.iitb.gymkhana.iitbapp.fragment.AddEventFragment"
>
tools:context=
"in.ac.iitb.gymkhana.iitbapp.fragment.AddEventFragment"
>
<ScrollView
<ScrollView
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"0dp"
android:layout_height=
"0dp"
...
@@ -53,17 +54,18 @@
...
@@ -53,17 +54,18 @@
android:orientation=
"horizontal"
>
android:orientation=
"horizontal"
>
<TextView
<TextView
android:id=
"@+id/tv_start"
android:layout_width=
"0dp"
android:layout_width=
"0dp"
android:layout_height=
"match_parent"
android:layout_weight=
"1"
android:layout_weight=
"1"
android:
paddingRight=
"6dp
"
android:
background=
"?attr/editTextBackground
"
android:gravity=
"bottom"
android:gravity=
"bottom"
android:layout_height=
"match_parent"
android:id=
"@+id/tv_start"
android:textSize=
"20sp"
android:hint=
"From "
android:hint=
"From "
android:paddingRight=
"6dp"
android:paddingTop=
"8dp"
android:textSize=
"20sp"
/>
android:background=
"?attr/editTextBackground"
android:paddingTop=
"8dp"
/>
<View
<View
android:layout_width=
"3dp"
android:layout_width=
"3dp"
android:layout_height=
"match_parent"
android:layout_height=
"match_parent"
...
@@ -72,35 +74,33 @@
...
@@ -72,35 +74,33 @@
android:background=
"@color/common_google_signin_btn_text_dark_disabled"
/>
android:background=
"@color/common_google_signin_btn_text_dark_disabled"
/>
<TextView
<TextView
android:id=
"@+id/tv_end"
android:layout_width=
"0dp"
android:layout_width=
"0dp"
android:layout_height=
"match_parent"
android:layout_weight=
"1"
android:layout_weight=
"1"
android:
paddingRight=
"6dp
"
android:
background=
"?attr/editTextBackground
"
android:gravity=
"bottom"
android:gravity=
"bottom"
android:layout_height=
"match_parent"
android:id=
"@+id/tv_end"
android:textSize=
"20sp"
android:hint=
"To "
android:hint=
"To "
android:paddingRight=
"6dp"
android:background=
"?attr/editTextBackground"
android:paddingTop=
"8dp"
android:paddingTop=
"8dp"
/>
android:textSize=
"20sp"
/>
</LinearLayout>
</LinearLayout>
<EditText
<EditText
android:
layout_width=
"match_parent
"
android:
id=
"@+id/et_venue
"
android:
paddingRight=
"6dp
"
android:
layout_width=
"match_parent
"
android:layout_height=
"40dp"
android:layout_height=
"40dp"
android:layout_marginLeft=
"15dp"
android:layout_marginLeft=
"15dp"
android:layout_marginRight=
"16dp"
android:layout_marginRight=
"16dp"
android:layout_marginTop=
"10dp"
android:layout_marginTop=
"10dp"
android:
textSize=
"20sp
"
android:
hint=
"Venue
"
android:
id=
"@+id/et_venue
"
android:
paddingRight=
"6dp
"
android:
hint=
"Venue"
/>
android:
textSize=
"20sp"
/>
<EditText
<EditText
android:id=
"@+id/et_eventDetails"
android:id=
"@+id/et_eventDetails"
...
@@ -111,72 +111,75 @@
...
@@ -111,72 +111,75 @@
android:layout_marginTop=
"8dp"
android:layout_marginTop=
"8dp"
android:layout_weight=
"1"
android:layout_weight=
"1"
android:gravity=
"top"
android:gravity=
"top"
android:textSize=
"20sp"
android:hint=
"Details"
android:hint=
"Details"
android:paddingRight=
"6dp"
/>
android:paddingRight=
"6dp"
android:textSize=
"20sp"
/>
<RelativeLayout
<RelativeLayout
android:id=
"@+id/advanced_menu"
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
>
android:id=
"@+id/advanced_menu"
>
<TextView
android:layout_height=
"30dp"
<TextView
android:layout_width=
"wrap_content"
android:layout_width=
"wrap_content"
android:
text=
"Advanced Options
"
android:
layout_height=
"30dp
"
android:paddingLeft=
"18dp"
android:paddingLeft=
"18dp"
android:textSize=
"20sp"
android:paddingRight=
"16dp"
android:paddingRight=
"16dp"
/>
android:text=
"Advanced Options"
android:textSize=
"20sp"
/>
<ImageView
<ImageView
android:id=
"@+id/close"
android:layout_width=
"wrap_content"
android:layout_width=
"wrap_content"
android:layout_height=
"30dp"
android:layout_height=
"30dp"
android:layout_alignParentEnd=
"true"
android:layout_alignParentEnd=
"true"
android:
id=
"@+id/close"
android:
src=
"@mipmap/advanced_menu_close"
/>
android:src=
"@mipmap/advanced_menu_close"
/>
<ImageView
<ImageView
android:id=
"@+id/open"
android:layout_width=
"wrap_content"
android:layout_width=
"wrap_content"
android:layout_height=
"30dp"
android:layout_height=
"30dp"
android:id=
"@+id/open"
android:layout_alignParentEnd=
"true"
android:layout_alignParentEnd=
"true"
android:src=
"@mipmap/advanced_menu_open"
/>
android:src=
"@mipmap/advanced_menu_open"
/>
</RelativeLayout>
</RelativeLayout>
<CheckBox
<CheckBox
android:id=
"@+id/cb_public"
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:id=
"@+id/cb_public"
android:layout_marginLeft=
"20dp"
android:layout_marginLeft=
"20dp"
android:layout_marginRight=
"12dp"
android:layout_marginRight=
"12dp"
android:text=
"Outsiders Allowed "
/>
android:text=
"Outsiders Allowed "
/>
<EditText
<EditText
android:id=
"@+id/map_location"
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:id=
"@+id/map_location"
android:layout_marginLeft=
"22dp"
android:layout_marginLeft=
"22dp"
android:layout_marginRight=
"12dp"
android:layout_marginRight=
"12dp"
android:hint=
"Map Location"
/>
android:hint=
"Map Location"
/>
<CheckBox
<CheckBox
android:id=
"@+id/cb_permission"
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"Request User Info"
android:layout_marginLeft=
"20dp"
android:layout_marginLeft=
"20dp"
android:layout_marginRight=
"12dp"
android:layout_marginRight=
"12dp"
android:
id=
"@+id/cb_permission"
/>
android:
text=
"Request User Info"
/>
</LinearLayout>
</LinearLayout>
</ScrollView>
</ScrollView>
<Button
<Button
android:id=
"@+id/button_createEvent"
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"40dp"
android:layout_height=
"40dp"
android:text=
"Create"
android:layout_margin=
"8dp"
android:layout_margin=
"8dp"
android:background=
"@drawable/round_text_box"
android:background=
"@drawable/round_text_box"
android:
id=
"@+id/button_createEvent
"
android:
gravity=
"center
"
android:
gravity=
"center"
/>
android:
text=
"Create"
/>
</LinearLayout>
</LinearLayout>
\ No newline at end of file
app/src/main/res/layout/fragment_event.xml
View file @
67138833
<LinearLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
<LinearLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:app=
"http://schemas.android.com/apk/res-auto"
xmlns:tools=
"http://schemas.android.com/tools"
xmlns:tools=
"http://schemas.android.com/tools"
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:layout_height=
"match_parent"
xmlns:app=
"http://schemas.android.com/apk/res-auto"
android:orientation=
"vertical"
android:orientation=
"vertical"
tools:context=
"in.ac.iitb.gymkhana.iitbapp.fragment.EventFragment"
>
tools:context=
"in.ac.iitb.gymkhana.iitbapp.fragment.EventFragment"
>
...
@@ -10,82 +10,88 @@
...
@@ -10,82 +10,88 @@
android:id=
"@+id/event_picture_2"
android:id=
"@+id/event_picture_2"
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"0dp"
android:layout_height=
"0dp"
android:
scaleType=
"centerCrop
"
android:
layout_weight=
"1
"
android:
layout_weight=
"1"
/>
android:
scaleType=
"centerCrop"
/>
<LinearLayout
<LinearLayout
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"0dp"
android:layout_height=
"0dp"
android:layout_weight=
"1"
android:layout_weight=
"1"
android:orientation=
"vertical"
>
android:orientation=
"vertical"
>
<android.support.v7.widget.CardView
<android.support.v7.widget.CardView
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
app:cardBackgroundColor=
"@color/colorPrimary"
>
app:cardBackgroundColor=
"@color/colorPrimary"
>
<LinearLayout
<LinearLayout
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_weight=
"3"
android:orientation=
"vertical"
android:layout_gravity=
"center_vertical"
android:layout_gravity=
"center_vertical"
android:layout_margin
Right=
"16
dp"
android:layout_margin
Bottom=
"12
dp"
android:layout_marginLeft=
"16dp"
android:layout_marginLeft=
"16dp"
android:layout_marginRight=
"16dp"
android:layout_marginTop=
"12dp"
android:layout_marginTop=
"12dp"
android:layout_marginBottom=
"12dp"
>
android:layout_weight=
"3"
android:orientation=
"vertical"
>
<TextView
<TextView
android:id=
"@+id/event_page_title"
android:id=
"@+id/event_page_title"
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:text
Size=
"28sp
"
android:text
=
"Event Title
"
android:textColor=
"#fff"
android:textColor=
"#fff"
android:text
=
"Event Title"
/>
android:text
Size=
"28sp"
/>
<LinearLayout
<LinearLayout
android:layout_width=
"wrap_content"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:orientation=
"horizontal"
>
android:orientation=
"horizontal"
>
<TextView
<TextView
android:id=
"@+id/event_page_date"
android:layout_width=
"wrap_content"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:id=
"@+id/event_page_date"
android:text=
"No Date Specified"
android:text=
"No Date Specified"
android:textSize=
"16sp"
android:textColor=
"#fff"
android:textColor=
"#fff"
/>
android:textSize=
"16sp"
/>
<TextView
<TextView
android:layout_width=
"wrap_content"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
" | "
android:text=
" | "
android:textSize=
"20sp"
android:textColor=
"#fff"
android:textColor=
"#fff"
/>
android:textSize=
"20sp"
/>
<TextView
<TextView
android:id=
"@+id/event_page_time"
android:layout_width=
"wrap_content"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:id=
"@+id/event_page_time"
android:text=
"No Time Specified"
android:text=
"No Time Specified"
android:textSize=
"16sp"
android:textColor=
"#fff"
android:textColor=
"#fff"
/>
android:textSize=
"16sp"
/>
<TextView
<TextView
android:layout_width=
"wrap_content"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
" | "
android:text=
" | "
android:textSize=
"20sp"
android:textColor=
"#fff"
android:textColor=
"#fff"
/>
android:textSize=
"20sp"
/>
<TextView
<TextView
android:id=
"@+id/event_page_venue"
android:layout_width=
"wrap_content"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:id=
"@+id/event_page_venue"
android:text=
"No Venue Specified"
android:ellipsize=
"end"
android:ellipsize=
"end"
android:textSize=
"16sp"
android:text=
"No Venue Specified"
android:textColor=
"#fff"
/>
android:textColor=
"#fff"
android:textSize=
"16sp"
/>
</LinearLayout>
</LinearLayout>
</LinearLayout>
</LinearLayout>
</android.support.v7.widget.CardView>
</android.support.v7.widget.CardView>
<LinearLayout
<LinearLayout
style=
"?android:attr/buttonBarStyle"
style=
"?android:attr/buttonBarStyle"
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
...
@@ -97,16 +103,17 @@
...
@@ -97,16 +103,17 @@
style=
"?android:attr/buttonBarButtonStyle"
style=
"?android:attr/buttonBarButtonStyle"
android:layout_width=
"0dp"
android:layout_width=
"0dp"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_margin=
"0dp"
android:layout_weight=
"1"
android:layout_weight=
"1"
android:text=
"Going"
android:text=
"Going"
android:
layout_margin=
"0dp"
android:
textColor=
"@color/colorGray"
/>
android:textColor=
"@color/colorGray"
/>
<View
<View
android:layout_width=
"1dp"
android:layout_width=
"1dp"
android:layout_height=
"match_parent"
android:layout_height=
"match_parent"
android:
background=
"#aaa
"
android:
layout_marginBottom=
"6dp
"
android:layout_marginTop=
"10dp"
android:layout_marginTop=
"10dp"
android:
layout_marginBottom=
"6dp
"
>
android:
background=
"#aaa
"
>
</View>
</View>
...
@@ -115,16 +122,17 @@
...
@@ -115,16 +122,17 @@
style=
"?android:attr/buttonBarButtonStyle"
style=
"?android:attr/buttonBarButtonStyle"
android:layout_width=
"0dp"
android:layout_width=
"0dp"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_margin=
"0dp"
android:layout_weight=
"1"
android:layout_weight=
"1"
android:text=
"Interested"
android:text=
"Interested"
android:
layout_margin=
"0dp"
android:
textColor=
"@color/colorGray"
/>
android:textColor=
"@color/colorGray"
/>
<View
<View
android:layout_width=
"1dp"
android:layout_width=
"1dp"
android:layout_height=
"match_parent"
android:layout_height=
"match_parent"
android:
background=
"#aaa
"
android:
layout_marginBottom=
"6dp
"
android:layout_marginTop=
"10dp"
android:layout_marginTop=
"10dp"
android:
layout_marginBottom=
"6dp
"
>
android:
background=
"#aaa
"
>
</View>
</View>
...
@@ -133,19 +141,19 @@
...
@@ -133,19 +141,19 @@
style=
"?android:attr/buttonBarButtonStyle"
style=
"?android:attr/buttonBarButtonStyle"
android:layout_width=
"0dp"
android:layout_width=
"0dp"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_margin=
"0dp"
android:layout_weight=
"1"
android:layout_weight=
"1"
android:text=
"Not Going"
android:text=
"Not Going"
android:layout_margin=
"0dp"
android:textColor=
"@color/colorGray"
/>
android:textColor=
"@color/colorGray"
/>
</LinearLayout>
</LinearLayout>
<View
<View
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"1dp"
android:layout_height=
"1dp"
android:background=
"#aaa"
android:layout_marginBottom=
"6dp"
android:layout_marginBottom=
"6dp"
android:layout_marginLeft=
"6dp"
android:layout_marginLeft=
"6dp"
android:layout_marginRight=
"6dp"
>
android:layout_marginRight=
"6dp"
android:background=
"#aaa"
>
</View>
</View>
...
@@ -153,10 +161,10 @@
...
@@ -153,10 +161,10 @@
android:id=
"@+id/event_page_description"
android:id=
"@+id/event_page_description"
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"8dp"
android:layout_marginLeft=
"8dp"
android:layout_marginLeft=
"8dp"
android:layout_marginRight=
"8dp"
android:layout_marginRight=
"8dp"
android:layout_marginTop=
"8dp"
android:textColor=
"#777"
android:textColor=
"#777"
android:textSize=
"16sp"
/>
android:textSize=
"16sp"
/>
</LinearLayout>
</LinearLayout>
</LinearLayout>
</LinearLayout>
app/src/main/res/layout/fragment_feed.xml
View file @
67138833
<RelativeLayout
android:layout_height=
"match_parent"
<RelativeLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:layout_width=
"match_parent"
xmlns:tools=
"http://schemas.android.com/tools"
xmlns:tools=
"http://schemas.android.com/tools"
android:id=
"@+id/relative_layout"
android:id=
"@+id/relative_layout"
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
<android.support.v4.widget.SwipeRefreshLayout
android:id=
"@+id/feed_swipe_refresh_layout"
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:layout_height=
"match_parent"
>
tools:context=
"in.ac.iitb.gymkhana.iitbapp.fragment.FeedFragment"
>
<android.support.v
7.widget.RecyclerView
<android.support.v
4.widget.SwipeRefreshLayout
android:id=
"@+id/feed_
recycler_view
"
android:id=
"@+id/feed_
swipe_refresh_layout
"
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:layout_height=
"match_parent"
android:paddingTop=
"8dp"
/>
tools:context=
"in.ac.iitb.gymkhana.iitbapp.fragment.FeedFragment"
>
<android.support.v7.widget.RecyclerView
android:id=
"@+id/feed_recycler_view"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:paddingTop=
"8dp"
/>
</android.support.v4.widget.SwipeRefreshLayout>
</android.support.v4.widget.SwipeRefreshLayout>
<android.support.design.widget.FloatingActionButton
<android.support.design.widget.FloatingActionButton
android:id=
"@+id/fab"
android:id=
"@+id/fab"
...
...
app/src/main/res/layout/fragment_my_events.xml
View file @
67138833
<RelativeLayout
android:layout_height=
"match_parent"
<RelativeLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:layout_width=
"match_parent"
android:id=
"@+id/relative_layout"
android:id=
"@+id/relative_layout"
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
>
<android.support.design.widget.FloatingActionButton
<android.support.design.widget.FloatingActionButton
android:id=
"@+id/fab"
android:id=
"@+id/fab"
android:layout_width=
"wrap_content"
android:layout_width=
"wrap_content"
...
...
app/src/main/res/layout/fragment_profile.xml
View file @
67138833
...
@@ -6,45 +6,45 @@
...
@@ -6,45 +6,45 @@
tools:context=
"in.ac.iitb.gymkhana.iitbapp.fragment.ProfileFragment"
>
tools:context=
"in.ac.iitb.gymkhana.iitbapp.fragment.ProfileFragment"
>
<de.hdodenhof.circleimageview.CircleImageView
<de.hdodenhof.circleimageview.CircleImageView
android:layout_margin=
"32dp"
android:id=
"@+id/user_profile_picture_profile"
android:id=
"@+id/user_profile_picture_profile"
android:layout_width=
"160dp"
android:layout_width=
"160dp"
android:layout_height=
"160dp"
/>
android:layout_height=
"160dp"
android:layout_margin=
"32dp"
/>
<LinearLayout
<LinearLayout
android:layout_marginTop=
"32dp"
android:orientation=
"vertical"
android:layout_width=
"wrap_content"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
>
android:layout_height=
"wrap_content"
android:layout_marginTop=
"32dp"
android:orientation=
"vertical"
>
<TextView
<TextView
android:textSize=
"20sp"
android:layout_marginBottom=
"2dp"
android:id=
"@+id/user_name_profile"
android:id=
"@+id/user_name_profile"
android:textStyle=
"bold"
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
/>
android:layout_height=
"wrap_content"
android:layout_marginBottom=
"2dp"
android:textSize=
"20sp"
android:textStyle=
"bold"
/>
<TextView
<TextView
android:textSize=
"16sp"
android:layout_marginBottom=
"2dp"
android:id=
"@+id/user_rollno_profile"
android:id=
"@+id/user_rollno_profile"
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
/>
android:layout_height=
"wrap_content"
android:layout_marginBottom=
"2dp"
android:textSize=
"16sp"
/>
<TextView
<TextView
android:textSize=
"16sp"
android:layout_marginBottom=
"2dp"
android:id=
"@+id/user_email_profile"
android:id=
"@+id/user_email_profile"
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
/>
android:layout_height=
"wrap_content"
android:layout_marginBottom=
"2dp"
android:textSize=
"16sp"
/>
<TextView
<TextView
android:textSize=
"16sp"
android:layout_marginBottom=
"2dp"
android:id=
"@+id/user_contact_no_profile"
android:id=
"@+id/user_contact_no_profile"
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
/>
android:layout_height=
"wrap_content"
android:layout_marginBottom=
"2dp"
android:textSize=
"16sp"
/>
</LinearLayout>
</LinearLayout>
</LinearLayout>
</LinearLayout>
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