Commit dc799311 authored by Sajal Narang's avatar Sajal Narang Committed by GitHub

Merge branch 'master' into back-navigation

parents 7544ef74 67138833
<component name="ProjectCodeStyleConfiguration">
<code_scheme name="Project" version="173">
<Objective-C-extensions>
<file>
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Import" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Macro" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Typedef" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Enum" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Constant" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Global" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Struct" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="FunctionPredecl" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Function" />
</file>
<class>
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Property" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Synthesize" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="InitMethod" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="StaticMethod" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="InstanceMethod" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="DeallocMethod" />
</class>
<extensions>
<pair source="cpp" header="h" fileNamingConvention="NONE" />
<pair source="c" header="h" fileNamingConvention="NONE" />
</extensions>
</Objective-C-extensions>
</code_scheme>
</component>
\ No newline at end of file
......@@ -2,7 +2,7 @@ apply plugin: 'com.android.application'
android {
compileSdkVersion 26
buildToolsVersion "26.0.2"
buildToolsVersion '27.0.3'
defaultConfig {
applicationId "in.ac.iitb.gymkhana.iitbapp"
manifestPlaceholders 'appAuthRedirectScheme': 'https'
......@@ -35,29 +35,29 @@ ext {
dependencies {
implementation 'com.android.support:support-v4:26.1.0'
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
implementation fileTree(dir: 'libs', include: ['*.jar'])
androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile "com.android.support:appcompat-v7:${supportLibVersion}"
compile "net.openid:appauth:${appAuthVersion}"
testCompile "junit:junit:4.12"
compile "com.android.support:design:${supportLibVersion}"
compile "com.android.support:support-v4:${supportLibVersion}"
compile "com.jakewharton:butterknife:${butterKnifeVersion}"
compile "com.google.android.gms:play-services-gcm:${playServicesVersion}"
compile "com.google.android.gms:play-services-maps:${playServicesVersion}"
compile "com.google.android.gms:play-services-location:${playServicesVersion}"
implementation "com.android.support:appcompat-v7:${supportLibVersion}"
implementation "net.openid:appauth:${appAuthVersion}"
testImplementation "junit:junit:4.12"
implementation "com.android.support:design:${supportLibVersion}"
implementation "com.android.support:support-v4:${supportLibVersion}"
implementation "com.jakewharton:butterknife:${butterKnifeVersion}"
implementation "com.google.android.gms:play-services-gcm:${playServicesVersion}"
implementation "com.google.android.gms:play-services-maps:${playServicesVersion}"
implementation "com.google.android.gms:play-services-location:${playServicesVersion}"
annotationProcessor "com.jakewharton:butterknife-compiler:${butterKnifeVersion}"
compile "com.squareup.retrofit2:retrofit:${retrofitVersion}"
compile "com.squareup.retrofit2:converter-gson:${retrofitVersion}"
compile "com.squareup.okhttp3:okhttp:${okhttpVersion}"
compile "com.squareup.okhttp3:logging-interceptor:${okhttpVersion}"
compile "com.squareup.picasso:picasso:${picassoVersion}"
compile "com.android.support:customtabs:${supportLibVersion}"
compile "android.arch.persistence.room:runtime:${archRoomVersion}"
implementation "com.squareup.retrofit2:retrofit:${retrofitVersion}"
implementation "com.squareup.retrofit2:converter-gson:${retrofitVersion}"
implementation "com.squareup.okhttp3:okhttp:${okhttpVersion}"
implementation "com.squareup.okhttp3:logging-interceptor:${okhttpVersion}"
implementation "com.squareup.picasso:picasso:${picassoVersion}"
implementation "com.android.support:customtabs:${supportLibVersion}"
implementation "android.arch.persistence.room:runtime:${archRoomVersion}"
annotationProcessor "android.arch.persistence.room:compiler:${archRoomVersion}"
implementation "com.android.support:cardview-v7:${supportLibVersion}"
compile "de.hdodenhof:circleimageview:${circleImageViewVersion}"
implementation "de.hdodenhof:circleimageview:${circleImageViewVersion}"
}
apply plugin: 'com.google.gms.google-services'
<?xml version="1.0" encoding="utf-8"?>
<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_COARSE_LOCATION" />
......
package in.ac.iitb.gymkhana.iitbapp;
import android.app.Activity;
import java.util.ArrayList;
import java.util.List;
/**
* A class which maintains a list of transactions to occur when Context becomes available.
*/
public final class ActivityBuffer {
private final List<IRunnable> mRunnables;
/* Member Variables. */
private Activity mActivity;
/**
* Constructor.
*/
public ActivityBuffer() {
// Initialize Member Variables.
this.mActivity = null;
this.mRunnables = new ArrayList<IRunnable>();
}
/**
* Executes the Runnable if there's an available Context. Otherwise, defers execution until it becomes available.
*/
public final void safely(final IRunnable pRunnable) {
// Synchronize along the current instance.
synchronized (this) {
// Do we have a context available?
if (this.isContextAvailable()) {
// Fetch the Activity.
final Activity lActivity = this.getActivity();
// Execute the Runnable along the Activity.
lActivity.runOnUiThread(new Runnable() {
@Override
public final void run() {
pRunnable.run(lActivity);
}
});
} else {
// Buffer the Runnable so that it's ready to receive a valid reference.
this.getRunnables().add(pRunnable);
}
}
}
/**
* Called to inform the ActivityBuffer that there's an available Activity reference.
*/
public final void onContextGained(final Activity pActivity) {
// Synchronize along ourself.
synchronized (this) {
// Update the Activity reference.
this.setActivity(pActivity);
// Are there any Runnables awaiting execution?
if (!this.getRunnables().isEmpty()) {
// Iterate the Runnables.
for (final IRunnable lRunnable : this.getRunnables()) {
// Execute the Runnable on the UI Thread.
pActivity.runOnUiThread(new Runnable() {
@Override
public final void run() {
// Execute the Runnable.
lRunnable.run(pActivity);
}
});
}
// Empty the Runnables.
this.getRunnables().clear();
}
}
}
/**
* Called to inform the ActivityBuffer that the Context has been lost.
*/
public final void onContextLost() {
// Synchronize along ourself.
synchronized (this) {
// Remove the Context reference.
this.setActivity(null);
}
}
/**
* Defines whether there's a safe Context available for the ActivityBuffer.
*/
public final boolean isContextAvailable() {
// Synchronize upon ourself.
synchronized (this) {
// Return the state of the Activity reference.
return (this.getActivity() != null);
}
}
private final Activity getActivity() {
return this.mActivity;
}
/* Getters and Setters. */
private final void setActivity(final Activity pActivity) {
this.mActivity = pActivity;
}
private final List<IRunnable> getRunnables() {
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
......@@ -3,8 +3,20 @@ package in.ac.iitb.gymkhana.iitbapp;
public class Constants {
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_LOCATION = 3;
public static final int RESULT_LOAD_IMAGE = 11;
public static final String NOTIFICATIONS_RESPONSE_JSON = "notifications_json";
public static final String EVENT_JSON = "event_json";
public static final java.lang.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_INTERESTED = 1;
public static final int STATUS_NOT_GOING = 0;
}
......@@ -40,8 +40,6 @@ import retrofit2.Response;
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 int PLAY_SERVICES_RESOLUTION_REQUEST = 9000;
//TODO: Change this to production before launch
......@@ -67,7 +65,7 @@ public class LoginActivity extends AppCompatActivity {
public void onReceive(Context context, Intent intent) {
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) {
String token = intent.getStringExtra("Token");
Log.d(TAG, "Going to login with :" + authCode + "\n" + token);
......@@ -254,7 +252,7 @@ public class LoginActivity extends AppCompatActivity {
private void registerReceiver() {
if (!isReceiverRegistered) {
LocalBroadcastManager.getInstance(this).registerReceiver(mRegistrationBroadcastReceiver,
new IntentFilter(REGISTRATION_COMPLETE));
new IntentFilter(Constants.REGISTRATION_COMPLETE));
isReceiverRegistered = true;
}
}
......
......@@ -4,7 +4,6 @@ import android.Manifest;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.support.design.widget.NavigationView;
import android.support.v4.app.ActivityCompat;
import android.support.v4.app.Fragment;
......@@ -27,9 +26,6 @@ import android.widget.Toast;
import com.google.gson.Gson;
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.data.User;
import in.ac.iitb.gymkhana.iitbapp.fragment.AboutFragment;
......@@ -46,23 +42,19 @@ import in.ac.iitb.gymkhana.iitbapp.fragment.PTCellFragment;
import in.ac.iitb.gymkhana.iitbapp.fragment.PeopleFragment;
import in.ac.iitb.gymkhana.iitbapp.fragment.ProfileFragment;
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_READ_EXTERNAL_STORAGE;
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 implements NavigationView.OnNavigationItemSelectedListener {
private static final String TAG = "MainActivity";
private User currentUser;
SessionManager session;
NotificationsResponse notificationsResponse;
private User currentUser;
private boolean showNotifications = false;
FeedFragment feedFragment;
......@@ -86,14 +78,14 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
feedFragment = new FeedFragment();
updateFragment(feedFragment);
fetchNotifications();
// fetchNotifications();
}
@Override
protected void onStart() {
super.onStart();
if (session.isLoggedIn()) {
currentUser = User.fromString(session.pref.getString(SessionManager.CURRENT_USER, "Error"));
currentUser = User.fromString(session.pref.getString(Constants.CURRENT_USER, "Error"));
updateNavigationView();
}
}
......@@ -122,28 +114,28 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
Picasso.with(this).load(currentUser.getUserProfilePictureUrl()).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
}
});
}
// 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);
......@@ -184,7 +176,7 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
//noinspection SimplifiableIfStatement
if (id == R.id.action_notifications) {
showNotifications = true;
fetchNotifications();
// fetchNotifications();
return true;
}
return super.onOptionsItemSelected(item);
......
......@@ -9,11 +9,6 @@ import android.util.Log;
import in.ac.iitb.gymkhana.iitbapp.data.User;
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;
Editor editor;
Context context;
......@@ -21,7 +16,7 @@ public class SessionManager {
public SessionManager(Context context) {
this.context = context;
pref = context.getSharedPreferences(PREF_NAME, PRIVATE_MODE);
pref = context.getSharedPreferences(Constants.PREF_NAME, PRIVATE_MODE);
editor = pref.edit();
}
......@@ -39,14 +34,14 @@ public class SessionManager {
public void createLoginSession(String gcmId, User currentUser, String sessionID) {
Log.d("SessionManager", "GcmId being stored");
editor.putBoolean(IS_LOGGED_IN, true);
editor.putString(GCM_ID, gcmId);
editor.putString(CURRENT_USER, currentUser.toString());
editor.putString(SESSION_ID, sessionID);
editor.putBoolean(Constants.IS_LOGGED_IN, true);
editor.putString(Constants.GCM_ID, gcmId);
editor.putString(Constants.CURRENT_USER, currentUser.toString());
editor.putString(Constants.SESSION_ID, sessionID);
editor.commit();
}
public boolean isLoggedIn() {
return pref.getBoolean(IS_LOGGED_IN, false);
return pref.getBoolean(Constants.IS_LOGGED_IN, false);
}
}
......@@ -10,18 +10,15 @@ import android.widget.TextView;
import com.squareup.picasso.Picasso;
import org.w3c.dom.Text;
import java.sql.Time;
import java.sql.Timestamp;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import java.util.logging.SimpleFormatter;
import in.ac.iitb.gymkhana.iitbapp.ItemClickListener;
import in.ac.iitb.gymkhana.iitbapp.R;
import in.ac.iitb.gymkhana.iitbapp.data.Event;
import in.ac.iitb.gymkhana.iitbapp.data.Venue;
public class FeedAdapter extends RecyclerView.Adapter<FeedAdapter.ViewHolder> {
......@@ -62,9 +59,14 @@ public class FeedAdapter extends RecyclerView.Adapter<FeedAdapter.ViewHolder> {
viewHolder.eventDate.setText(simpleDateFormatDate.format(Date));
viewHolder.eventTime.setText(simpleDateFormatTime.format(Date));
viewHolder.eventVenue.setText(currentEvent.getEventVenues().get(0).getVenueName());
StringBuilder eventVenueName = new StringBuilder();
for (Venue venue : currentEvent.getEventVenues()) {
eventVenueName.append(", ").append(venue.getVenueName());
}
if (!eventVenueName.toString().equals(""))
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
......@@ -75,7 +77,7 @@ public class FeedAdapter extends RecyclerView.Adapter<FeedAdapter.ViewHolder> {
public class ViewHolder extends RecyclerView.ViewHolder {
private ImageView eventPicture;
private TextView eventTitle;
// private TextView eventDetails;
// private TextView eventDetails;
private TextView eventDate;
private TextView eventTime;
private TextView eventVenue;
......
......@@ -6,8 +6,6 @@ import in.ac.iitb.gymkhana.iitbapp.api.model.ImageUploadRequest;
import in.ac.iitb.gymkhana.iitbapp.api.model.ImageUploadResponse;
import in.ac.iitb.gymkhana.iitbapp.api.model.LoginResponse;
import in.ac.iitb.gymkhana.iitbapp.api.model.NewsFeedResponse;
import in.ac.iitb.gymkhana.iitbapp.api.model.NotificationsRequest;
import in.ac.iitb.gymkhana.iitbapp.api.model.NotificationsResponse;
import in.ac.iitb.gymkhana.iitbapp.data.User;
import retrofit2.Call;
import retrofit2.http.Body;
......@@ -30,9 +28,12 @@ public interface RetrofitInterface {
@GET("users/{uuid}")
Call<User> getUser(@Header("Cookie") String sessionId, @Path("uuid") String uuid);
@POST("getNotifications/")
Call<NotificationsResponse> getNotifications(@Body NotificationsRequest notificationsRequest);
@POST("upload")
Call<ImageUploadResponse> uploadImage(@Header("Cookie") String sessionId, @Body ImageUploadRequest imageUploadRequest);
Call<ImageUploadResponse> uploadImage(@Header("Cookie") String sessionID, @Body ImageUploadRequest imageUploadRequest);
@GET("user-me/ues/{eventID}")
Call<Void> updateUserEventStatus(@Header("Cookie") String sessionID, @Path("eventID") String eventID, @Query("status") int status);
// @POST("getNotifications/")
// Call<NotificationsResponse> getNotifications(@Body NotificationsRequest notificationsRequest);
}
package in.ac.iitb.gymkhana.iitbapp.api.model;
import android.media.Image;
import android.support.annotation.Nullable;
import com.google.gson.annotations.SerializedName;
import java.sql.Timestamp;
import java.util.List;
public class EventCreateRequest {
......
package in.ac.iitb.gymkhana.iitbapp.api.model;
import com.google.gson.annotations.SerializedName;
/**
* Created by mrunz on 15/7/17.
*/
......@@ -13,9 +11,9 @@ public class EventCreateResponse {
private String eventId;
public EventCreateResponse(String result,String eventId){
this.result=result;
this.eventId=eventId;
public EventCreateResponse(String result, String eventId) {
this.result = result;
this.eventId = eventId;
}
public String getResult() {
......
package in.ac.iitb.gymkhana.iitbapp.api.model;
import com.google.gson.annotations.SerializedName;
import in.ac.iitb.gymkhana.iitbapp.data.User;
public class LoginResponse {
......
......@@ -10,14 +10,12 @@ import android.content.Context;
* 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})
public abstract class AppDatabase extends RoomDatabase {
private static AppDatabase INSTANCE;
public abstract DbDao dbDao();
public static AppDatabase getAppDatabase(Context context) {
if (INSTANCE == null) {
INSTANCE =
......@@ -33,4 +31,6 @@ public abstract class AppDatabase extends RoomDatabase {
public static void destroyInstance() {
INSTANCE = null;
}
public abstract DbDao dbDao();
}
......@@ -7,8 +7,6 @@ import com.google.gson.reflect.TypeToken;
import java.lang.reflect.Type;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
/**
......@@ -18,7 +16,8 @@ import java.util.List;
public class Converters {
@TypeConverter
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);
}
......@@ -31,7 +30,8 @@ public class Converters {
@TypeConverter
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);
}
......@@ -41,9 +41,11 @@ public class Converters {
String json = gson.toJson(list);
return json;
}
@TypeConverter
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);
}
......@@ -53,9 +55,11 @@ public class Converters {
String json = gson.toJson(list);
return json;
}
@TypeConverter
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);
}
......
......@@ -7,8 +7,6 @@ import android.arch.persistence.room.Query;
import java.util.List;
import retrofit2.http.DELETE;
/**
* Created by mrunz on 13/3/18.
*/
......
......@@ -10,8 +10,6 @@ import com.google.gson.annotations.SerializedName;
import java.util.List;
import static android.content.ContentValues.TAG;
@Entity(tableName = "users")
public class User {
@PrimaryKey(autoGenerate = true)
......@@ -69,6 +67,10 @@ public class User {
this.userFollowedBodiesID = userFollowedBodiesID;
}
public static User fromString(String json) {
return new Gson().fromJson(json, User.class);
}
public String getUserID() {
return userID;
}
......@@ -169,9 +171,4 @@ public class User {
public String toString() {
return new Gson().toJson(this);
}
public static User fromString(String json) {
Log.d(TAG, "fromString: " + json);
return new Gson().fromJson(json, User.class);
}
}
......@@ -12,7 +12,7 @@ import in.ac.iitb.gymkhana.iitbapp.R;
/**
* A simple {@link Fragment} subclass.
*/
public class AboutFragment extends Fragment {
public class AboutFragment extends BaseFragment {
public AboutFragment() {
......
......@@ -13,7 +13,6 @@ import android.net.Uri;
import android.os.Bundle;
import android.provider.MediaStore;
import android.support.v4.app.ActivityCompat;
import android.support.v4.app.Fragment;
import android.support.v4.content.ContextCompat;
import android.util.Base64;
import android.util.Log;
......@@ -38,6 +37,7 @@ import java.util.Calendar;
import butterknife.BindView;
import butterknife.ButterKnife;
import in.ac.iitb.gymkhana.iitbapp.Constants;
import in.ac.iitb.gymkhana.iitbapp.R;
import in.ac.iitb.gymkhana.iitbapp.api.RetrofitInterface;
import in.ac.iitb.gymkhana.iitbapp.api.ServiceGenerator;
......@@ -50,13 +50,11 @@ import retrofit2.Callback;
import retrofit2.Response;
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.RESULT_LOAD_IMAGE;
import static in.ac.iitb.gymkhana.iitbapp.SessionManager.SESSION_ID;
public class AddEventFragment extends Fragment {
public class AddEventFragment extends BaseFragment {
@BindView(R.id.button_createEvent)
Button createEvent;
@BindView(R.id.tv_start)
......@@ -93,12 +91,23 @@ public class AddEventFragment extends Fragment {
View view;
String base64Image;
ProgressDialog progressDialog;
String TAG = "AddEventFragment";
public AddEventFragment() {
// 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
public View onCreateView(LayoutInflater inflater, ViewGroup container,
......@@ -243,7 +252,7 @@ public class AddEventFragment extends Fragment {
progressDialog.setMessage("Uploading Image");
ImageUploadRequest imageUploadRequest = new ImageUploadRequest(base64Image);
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
public void onResponse(Call<ImageUploadResponse> call, Response<ImageUploadResponse> response) {
if (response.isSuccessful()) {
......@@ -264,7 +273,7 @@ public class AddEventFragment extends Fragment {
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"}));
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
public void onResponse(Call<EventCreateResponse> call, Response<EventCreateResponse> response) {
Toast.makeText(getContext(), "Event Created", Toast.LENGTH_SHORT).show();
......@@ -279,17 +288,6 @@ public class AddEventFragment extends Fragment {
});
}
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
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
......
package in.ac.iitb.gymkhana.iitbapp.fragment;
import android.app.Activity;
import android.content.Context;
import android.support.v4.app.Fragment;
import in.ac.iitb.gymkhana.iitbapp.ActivityBuffer;
/**
* A simple {@link Fragment} subclass.
*/
public class BaseFragment extends Fragment {
/* Member Variables. */
private ActivityBuffer mActivityBuffer;
public BaseFragment() {
// Implement the Parent.
super();
// Allocate the ActivityBuffer.
this.mActivityBuffer = new ActivityBuffer();
}
@Override
public final void onAttach(final Context pContext) {
// Handle as usual.
super.onAttach(pContext);
// Is the Context an Activity?
if (pContext instanceof Activity) {
// Cast Accordingly.
final Activity lActivity = (Activity) pContext;
// Inform the ActivityBuffer.
this.getActivityBuffer().onContextGained(lActivity);
}
}
@Deprecated
@Override
public final void onAttach(final Activity pActivity) {
// Handle as usual.
super.onAttach(pActivity);
// Inform the ActivityBuffer.
this.getActivityBuffer().onContextGained(pActivity);
}
@Override
public final void onDetach() {
// Handle as usual.
super.onDetach();
// Inform the ActivityBuffer.
this.getActivityBuffer().onContextLost();
}
/* Getters. */
public final ActivityBuffer getActivityBuffer() {
return this.mActivityBuffer;
}
}
\ No newline at end of file
......@@ -12,7 +12,7 @@ import in.ac.iitb.gymkhana.iitbapp.R;
/**
* A simple {@link Fragment} subclass.
*/
public class CMSFragment extends Fragment {
public class CMSFragment extends BaseFragment {
public CMSFragment() {
......
......@@ -17,7 +17,7 @@ import in.ac.iitb.gymkhana.iitbapp.R;
/**
* A simple {@link Fragment} subclass.
*/
public class CalendarFragment extends Fragment {
public class CalendarFragment extends BaseFragment {
FloatingActionButton fab;
private View view;
......
......@@ -12,7 +12,7 @@ import in.ac.iitb.gymkhana.iitbapp.R;
/**
* A simple {@link Fragment} subclass.
*/
public class ContactsFragment extends Fragment {
public class ContactsFragment extends BaseFragment {
public ContactsFragment() {
......
......@@ -3,11 +3,14 @@ package in.ac.iitb.gymkhana.iitbapp.fragment;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;
import com.google.gson.Gson;
import com.squareup.picasso.Picasso;
......@@ -18,13 +21,23 @@ import java.util.Date;
import in.ac.iitb.gymkhana.iitbapp.Constants;
import in.ac.iitb.gymkhana.iitbapp.R;
import in.ac.iitb.gymkhana.iitbapp.api.RetrofitInterface;
import in.ac.iitb.gymkhana.iitbapp.api.ServiceGenerator;
import in.ac.iitb.gymkhana.iitbapp.data.Event;
import in.ac.iitb.gymkhana.iitbapp.data.Venue;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
/**
* A simple {@link Fragment} subclass.
*/
public class EventFragment extends Fragment {
public class EventFragment extends BaseFragment implements View.OnClickListener {
Event event;
Button goingButton;
Button interestedButton;
Button notGoingButton;
String TAG = "EventFragment";
public EventFragment() {
// Required empty public constructor
......@@ -44,7 +57,8 @@ public class EventFragment extends Fragment {
Bundle bundle = getArguments();
String eventJson = bundle.getString(Constants.EVENT_JSON);
Event event = new Gson().fromJson(eventJson, Event.class);
Log.d(TAG, "onStart: " + eventJson);
event = new Gson().fromJson(eventJson, Event.class);
inflateViews(event);
}
......@@ -55,6 +69,9 @@ public class EventFragment extends Fragment {
TextView eventTime = (TextView) getActivity().findViewById(R.id.event_page_time);
TextView eventVenue = (TextView) getActivity().findViewById(R.id.event_page_venue);
TextView eventDescription = (TextView) getActivity().findViewById(R.id.event_page_description);
goingButton = getActivity().findViewById(R.id.going_button);
interestedButton = getActivity().findViewById(R.id.interested_button);
notGoingButton = getActivity().findViewById(R.id.not_going_button);
Picasso.with(getContext()).load(event.getEventImageURL()).into(eventPicture);
eventTitle.setText(event.getEventName());
......@@ -65,6 +82,50 @@ public class EventFragment extends Fragment {
SimpleDateFormat simpleDateFormatTime = new SimpleDateFormat("HH:mm a");
eventDate.setText(simpleDateFormatDate.format(Date));
eventTime.setText(simpleDateFormatTime.format(Date));
eventVenue.setText(event.getEventVenues().get(0).getVenueName());
StringBuilder eventVenueName = new StringBuilder();
for (Venue venue : event.getEventVenues()) {
eventVenueName.append(", ").append(venue.getVenueName());
}
if (!eventVenueName.toString().equals(""))
eventVenue.setText(eventVenueName.toString().substring(2));
goingButton.setOnClickListener(this);
interestedButton.setOnClickListener(this);
notGoingButton.setOnClickListener(this);
}
@Override
public void onClick(View view) {
goingButton.setBackgroundColor(getResources().getColor(R.color.colorWhite));
interestedButton.setBackgroundColor(getResources().getColor(R.color.colorWhite));
notGoingButton.setBackgroundColor(getResources().getColor(R.color.colorWhite));
view.setBackgroundColor(getResources().getColor(R.color.colorAccent));
int status = 0;
switch (view.getId()) {
case R.id.going_button:
status = Constants.STATUS_GOING;
break;
case R.id.interested_button:
status = Constants.STATUS_INTERESTED;
break;
case R.id.not_going_button:
status = Constants.STATUS_NOT_GOING;
break;
}
RetrofitInterface retrofitInterface = ServiceGenerator.createService(RetrofitInterface.class);
retrofitInterface.updateUserEventStatus("sessionid=" + getArguments().getString(Constants.SESSION_ID), event.getEventID(), status).enqueue(new Callback<Void>() {
@Override
public void onResponse(Call<Void> call, Response<Void> response) {
if (response.isSuccessful()) {
}
}
@Override
public void onFailure(Call<Void> call, Throwable t) {
//TODO: Store the status offline and update when connected
Toast.makeText(getContext(), "Network Error", Toast.LENGTH_LONG).show();
}
});
}
}
package in.ac.iitb.gymkhana.iitbapp.fragment;
import android.content.ContentValues;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.app.Activity;
import android.os.Bundle;
import android.support.design.widget.FloatingActionButton;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentTransaction;
import android.support.v4.widget.SwipeRefreshLayout;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.google.gson.Gson;
import java.util.ArrayList;
import java.util.List;
import in.ac.iitb.gymkhana.iitbapp.ActivityBuffer;
import in.ac.iitb.gymkhana.iitbapp.Constants;
import in.ac.iitb.gymkhana.iitbapp.ItemClickListener;
import in.ac.iitb.gymkhana.iitbapp.MainActivity;
......@@ -35,16 +33,15 @@ import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
import static in.ac.iitb.gymkhana.iitbapp.SessionManager.SESSION_ID;
/**
* A simple {@link Fragment} subclass.
*/
public class FeedFragment extends Fragment {
public class FeedFragment extends BaseFragment {
private RecyclerView feedRecyclerView;
private SwipeRefreshLayout feedSwipeRefreshLayout;
private AppDatabase appDatabase;
private FloatingActionButton fab;
public FeedFragment() {
// Required empty public constructor
......@@ -56,35 +53,35 @@ public class FeedFragment extends Fragment {
Bundle savedInstanceState) {
// Inflate the layout for this fragment
return 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.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
AddEventFragment addEventFragment = new AddEventFragment();
addEventFragment.setArguments(getArguments());
FragmentTransaction ft = getChildFragmentManager().beginTransaction();
ft.replace(R.id.relative_layout, addEventFragment);
ft.addToBackStack("addEvent");
ft.commit();
}
});
return view;
}
@Override
public void onStart() {
super.onStart();
appDatabase= AppDatabase.getAppDatabase(getContext());
final List<Event> events=appDatabase.dbDao().getAllEvents();
FeedAdapter feedAdapter = new FeedAdapter(events, new ItemClickListener() {
@Override
public void onItemClick(View v, int position) {
String eventJson = new Gson().toJson(events.get(position));
Bundle bundle = new Bundle();
bundle.putString(Constants.EVENT_JSON, eventJson);
EventFragment eventFragment = new EventFragment();
eventFragment.setArguments(bundle);
((MainActivity) getActivity()).updateFragment(eventFragment);
}
});
feedRecyclerView = (RecyclerView) getActivity().findViewById(R.id.feed_recycler_view);
feedRecyclerView.setAdapter(feedAdapter);
feedRecyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
// }
appDatabase = AppDatabase.getAppDatabase(getContext());
final List<Event> events = appDatabase.dbDao().getAllEvents();
displayEvents(events);
updateFeed();
feedSwipeRefreshLayout = (SwipeRefreshLayout) getActivity().findViewById(R.id.feed_swipe_refresh_layout);
feedSwipeRefreshLayout = getActivity().findViewById(R.id.feed_swipe_refresh_layout);
feedSwipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
@Override
public void onRefresh() {
......@@ -95,33 +92,19 @@ public class FeedFragment extends Fragment {
private void updateFeed() {
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
public void onResponse(Call<NewsFeedResponse> call, Response<NewsFeedResponse> response) {
if (response.isSuccessful()) {
NewsFeedResponse newsFeedResponse = response.body();
final List<Event> events = newsFeedResponse.getEvents();
FeedAdapter feedAdapter = new FeedAdapter(events, new ItemClickListener() {
@Override
public void onItemClick(View v, int position) {
String eventJson = new Gson().toJson(events.get(position));
Bundle bundle = new Bundle();
bundle.putString(Constants.EVENT_JSON, eventJson);
EventFragment eventFragment = new EventFragment();
eventFragment.setArguments(bundle);
((MainActivity) getActivity()).updateFragment(eventFragment);
}
});
feedRecyclerView = (RecyclerView) getActivity().findViewById(R.id.feed_recycler_view);
feedRecyclerView.setAdapter(feedAdapter);
feedRecyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
List<Event> events = newsFeedResponse.getEvents();
displayEvents(events);
appDatabase.dbDao().deleteEvents();
appDatabase.dbDao().insertEvents(events);
//Server Error
feedSwipeRefreshLayout.setRefreshing(false);
}
//Server Error
feedSwipeRefreshLayout.setRefreshing(false);
}
@Override
......@@ -131,4 +114,32 @@ public class FeedFragment extends Fragment {
}
});
}
private void displayEvents(final List<Event> events) {
FeedAdapter feedAdapter = new FeedAdapter(events, new ItemClickListener() {
@Override
public void onItemClick(View v, int position) {
String eventJson = new Gson().toJson(events.get(position));
Bundle bundle = getArguments();
if (bundle == null)
bundle = new Bundle();
bundle.putString(Constants.EVENT_JSON, eventJson);
EventFragment eventFragment = new EventFragment();
eventFragment.setArguments(bundle);
FragmentManager manager = getActivity().getSupportFragmentManager();
FragmentTransaction transaction = manager.beginTransaction();
transaction.replace(R.id.framelayout_for_fragment, eventFragment, eventFragment.getTag());
transaction.commit();
}
});
getActivityBuffer().safely(new ActivityBuffer.IRunnable() {
@Override
public void run(Activity pActivity) {
feedRecyclerView = pActivity.findViewById(R.id.feed_recycler_view);
}
});
feedRecyclerView.setAdapter(feedAdapter);
feedRecyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
}
}
......@@ -12,7 +12,7 @@ import in.ac.iitb.gymkhana.iitbapp.R;
/**
* A simple {@link Fragment} subclass.
*/
public class GCRankingsFragment extends Fragment {
public class GCRankingsFragment extends BaseFragment {
public GCRankingsFragment() {
......
......@@ -4,7 +4,6 @@ import android.Manifest;
import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.IntentSender;
import android.content.pm.PackageManager;
import android.content.res.ColorStateList;
......@@ -12,13 +11,10 @@ import android.graphics.Color;
import android.graphics.PorterDuff;
import android.location.Location;
import android.location.LocationManager;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.provider.Settings;
import android.support.design.widget.FloatingActionButton;
import android.support.v4.app.ActivityCompat;
import android.support.v4.app.Fragment;
import android.support.v4.content.ContextCompat;
import android.util.Log;
import android.view.LayoutInflater;
......@@ -50,11 +46,12 @@ import com.google.android.gms.maps.model.MarkerOptions;
import java.util.List;
import in.ac.iitb.gymkhana.iitbapp.Constants;
import in.ac.iitb.gymkhana.iitbapp.R;
import static android.content.Context.LOCATION_SERVICE;
public class MapFragment extends Fragment implements OnMapReadyCallback, LocationListener,
public class MapFragment extends BaseFragment implements OnMapReadyCallback, LocationListener,
GoogleApiClient.ConnectionCallbacks, GoogleApiClient.OnConnectionFailedListener {
SupportMapFragment gMapFragment;
......@@ -65,7 +62,6 @@ public class MapFragment extends Fragment implements OnMapReadyCallback, Locatio
LocationRequest mLocationRequest;
private FloatingActionButton locationButton;
private Location currentLocation;
public static final int MY_PERMISSIONS_REQUEST_LOCATION = 99;
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
......@@ -77,8 +73,9 @@ public class MapFragment extends Fragment implements OnMapReadyCallback, Locatio
return view;
}
@Override
public void onStart(){
public void onStart() {
super.onStart();
locationButton = (FloatingActionButton) getActivity().findViewById(R.id.location_button);
locationButton.setImageResource(R.drawable.ic_my_location_black_24dp);
......@@ -87,7 +84,7 @@ public class MapFragment extends Fragment implements OnMapReadyCallback, Locatio
locationButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Log.v("MapFragment", "Location button pressed" );
Log.v("MapFragment", "Location button pressed");
try {
LocationManager lm = (LocationManager) getContext().getSystemService(Context.LOCATION_SERVICE);
......@@ -95,19 +92,21 @@ public class MapFragment extends Fragment implements OnMapReadyCallback, Locatio
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) {
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;
}
try {
gps_enabled = lm.isProviderEnabled(LocationManager.GPS_PROVIDER);
} catch(Exception ex) {}
} catch (Exception ex) {
}
try {
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();
......@@ -163,7 +162,7 @@ public class MapFragment extends Fragment implements OnMapReadyCallback, Locatio
}
} catch (Exception e){
} catch (Exception e) {
checkLocationPermission();
Toast.makeText(getContext(), "Please turn on Location from the Settings", Toast.LENGTH_SHORT).show();
......@@ -188,7 +187,7 @@ public class MapFragment extends Fragment implements OnMapReadyCallback, Locatio
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
Location l = mLocationManager.getLastKnownLocation(provider);
......@@ -263,7 +262,7 @@ public class MapFragment extends Fragment implements OnMapReadyCallback, Locatio
public void onClick(DialogInterface dialogInterface, int i) {
//Prompt the user once explanation has been shown
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 Fragment implements OnMapReadyCallback, Locatio
} else {
// No explanation needed, we can request the permission.
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 Fragment implements OnMapReadyCallback, Locatio
.build();
mGoogleApiClient.connect();
}
@Override
public void onLocationChanged(Location location) {
mLastLocation = location;
......@@ -298,13 +298,14 @@ public class MapFragment extends Fragment implements OnMapReadyCallback, Locatio
LatLng latLng = new LatLng(location.getLatitude(), location.getLongitude());
//move map camera
googleMap.moveCamera(CameraUpdateFactory.newLatLng(latLng));
googleMap .animateCamera(CameraUpdateFactory.zoomTo(17));
googleMap.animateCamera(CameraUpdateFactory.zoomTo(17));
//stop location updates
if (mGoogleApiClient != null) {
LocationServices.FusedLocationApi.removeLocationUpdates(mGoogleApiClient, this);
}
}
@Override
public void onConnectionSuspended(int i) {
}
......@@ -313,7 +314,7 @@ public class MapFragment extends Fragment implements OnMapReadyCallback, Locatio
public void onRequestPermissionsResult(int requestCode,
String permissions[], int[] grantResults) {
switch (requestCode) {
case MY_PERMISSIONS_REQUEST_LOCATION: {
case Constants.MY_PERMISSIONS_REQUEST_LOCATION: {
// If request is cancelled, the result arrays are empty.
if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
if (ContextCompat.checkSelfPermission(getActivity(), Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED) {
......@@ -327,6 +328,7 @@ public class MapFragment extends Fragment implements OnMapReadyCallback, Locatio
}
}
}
@Override
public void onConnectionFailed(ConnectionResult connectionResult) {
}
......@@ -345,5 +347,4 @@ public class MapFragment extends Fragment implements OnMapReadyCallback, Locatio
}
}
......@@ -12,7 +12,7 @@ import in.ac.iitb.gymkhana.iitbapp.R;
/**
* A simple {@link Fragment} subclass.
*/
public class MessMenuFragment extends Fragment {
public class MessMenuFragment extends BaseFragment {
public MessMenuFragment() {
......
......@@ -2,7 +2,9 @@ package in.ac.iitb.gymkhana.iitbapp.fragment;
import android.os.Bundle;
import android.support.design.widget.FloatingActionButton;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentTransaction;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
......@@ -12,8 +14,9 @@ import in.ac.iitb.gymkhana.iitbapp.R;
/**
* A simple {@link Fragment} subclass.
*/
public class MyEventsFragment extends Fragment {
public class MyEventsFragment extends BaseFragment {
FloatingActionButton fab;
public MyEventsFragment() {
// Required empty public constructor
......@@ -24,7 +27,24 @@ public class MyEventsFragment extends Fragment {
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
return 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.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
AddEventFragment addEventFragment = new AddEventFragment();
addEventFragment.setArguments(getArguments());
FragmentTransaction ft = getChildFragmentManager().beginTransaction();
ft.replace(R.id.relative_layout, addEventFragment);
ft.addToBackStack("addEvent");
ft.commit();
}
});
return view;
}
}
......@@ -23,7 +23,7 @@ import in.ac.iitb.gymkhana.iitbapp.api.model.NotificationsResponse;
/**
* A simple {@link Fragment} subclass.
*/
public class NotificationsFragment extends Fragment {
public class NotificationsFragment extends BaseFragment {
RecyclerView notificationsRecyclerView;
......
......@@ -12,7 +12,7 @@ import in.ac.iitb.gymkhana.iitbapp.R;
/**
* A simple {@link Fragment} subclass.
*/
public class PTCellFragment extends Fragment {
public class PTCellFragment extends BaseFragment {
public PTCellFragment() {
......
......@@ -3,7 +3,6 @@ package in.ac.iitb.gymkhana.iitbapp.fragment;
import android.app.SearchManager;
import android.content.Context;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.view.MenuItemCompat;
import android.support.v7.widget.SearchView;
import android.view.LayoutInflater;
......@@ -20,7 +19,7 @@ import in.ac.iitb.gymkhana.iitbapp.PeopleSuggestionAdapter;
import in.ac.iitb.gymkhana.iitbapp.R;
public class PeopleFragment extends Fragment {
public class PeopleFragment extends BaseFragment {
View view;
SearchView searchView;
PeopleSuggestionAdapter adapter;
......
......@@ -20,12 +20,10 @@ import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
import static in.ac.iitb.gymkhana.iitbapp.SessionManager.SESSION_ID;
/**
* A simple {@link Fragment} subclass.
*/
public class ProfileFragment extends Fragment {
public class ProfileFragment extends BaseFragment {
User user;
public ProfileFragment() {
......@@ -47,7 +45,7 @@ public class ProfileFragment extends Fragment {
String userID = bundle.getString(Constants.USER_ID);
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
public void onResponse(Call<User> call, Response<User> response) {
if (response.isSuccessful()) {
......
......@@ -12,7 +12,7 @@ import in.ac.iitb.gymkhana.iitbapp.R;
/**
* A simple {@link Fragment} subclass.
*/
public class TimetableFragment extends Fragment {
public class TimetableFragment extends BaseFragment {
public TimetableFragment() {
......
......@@ -16,13 +16,11 @@ import android.widget.Toast;
import com.google.android.gms.gcm.GoogleCloudMessaging;
import com.google.android.gms.iid.InstanceID;
import in.ac.iitb.gymkhana.iitbapp.Constants;
@TargetApi(Build.VERSION_CODES.CUPCAKE)
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";
......@@ -44,15 +42,15 @@ public class RegistrationIntentService extends IntentService {
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) {
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
Intent registrationComplete = new Intent(REGISTRATION_COMPLETE);
Intent registrationComplete = new Intent(Constants.REGISTRATION_COMPLETE);
registrationComplete.putExtra("Token", token);
LocalBroadcastManager.getInstance(this).sendBroadcast(registrationComplete);
}
......
<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.CardView
xmlns:android="http://schemas.android.com/apk/res/android"
<android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:card_view="http://schemas.android.com/apk/res-auto"
android:layout_height="wrap_content"
android:layout_width="match_parent"
card_view:cardElevation="4dp"
card_view:cardCornerRadius="4dp"
android:layout_marginTop="4dp"
android:layout_height="wrap_content"
android:layout_marginBottom="4dp"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:layout_marginLeft="8dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
android:layout_marginTop="4dp"
card_view:cardCornerRadius="4dp"
card_view:cardElevation="4dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="80dp"
android:orientation="horizontal">
<ImageView
android:id="@+id/event_picture"
android:layout_width="80dp"
android:layout_height="80dp"
android:layout_gravity="center"
android:scaleType="centerCrop"/>
android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="3"
android:orientation="vertical"
android:layout_gravity="center_vertical"
android:layout_marginRight="12dp"
android:layout_marginLeft="12dp">
<TextView
android:id="@+id/event_title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColor="@android:color/black"
android:textSize="18sp"
android:text="Event Title"/>
android:layout_height="80dp"
android:orientation="horizontal">
<ImageView
android:id="@+id/event_picture"
android:layout_width="80dp"
android:layout_height="80dp"
android:layout_gravity="center"
android:scaleType="centerCrop" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/event_date"
android:text="26 May"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=" | "
android:textSize="20dp"/>
android:layout_gravity="center_vertical"
android:layout_marginLeft="12dp"
android:layout_marginRight="12dp"
android:layout_weight="3"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:id="@+id/event_title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/event_time"
android:text="6:00 PM"/>
<TextView
android:text="Event Title"
android:textColor="@android:color/black"
android:textSize="18sp" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=" | "
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>
android:orientation="horizontal">
</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:layout_width="wrap_content"-->
<!--android:layout_marginRight="20dp"-->
......@@ -86,14 +92,14 @@
<!--android:src="@drawable/ic_action_add"-->
<!--android:layout_gravity="center_vertical"/>-->
</LinearLayout>
<!--<View-->
</LinearLayout>
<!--<View-->
<!--android:layout_width="match_parent"-->
<!--android:layout_height="2dp"-->
<!--android:background="#adfff6"-->
<!--android:layout_marginLeft="16dp"-->
<!--android:layout_marginRight="16dp">-->
<!--</View>-->
</LinearLayout>
<!--</View>-->
</LinearLayout>
</android.support.v7.widget.CardView>
\ No newline at end of file
......@@ -4,6 +4,7 @@
android:layout_height="match_parent"
android:orientation="vertical"
tools:context="in.ac.iitb.gymkhana.iitbapp.fragment.AddEventFragment">
<ScrollView
android:layout_width="match_parent"
android:layout_height="0dp"
......@@ -53,17 +54,18 @@
android:orientation="horizontal">
<TextView
android:id="@+id/tv_start"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:paddingRight="6dp"
android:background="?attr/editTextBackground"
android:gravity="bottom"
android:layout_height="match_parent"
android:id="@+id/tv_start"
android:textSize="20sp"
android:hint="From "
android:paddingRight="6dp"
android:paddingTop="8dp"
android:textSize="20sp" />
android:background="?attr/editTextBackground"
android:paddingTop="8dp"/>
<View
android:layout_width="3dp"
android:layout_height="match_parent"
......@@ -72,35 +74,33 @@
android:background="@color/common_google_signin_btn_text_dark_disabled" />
<TextView
android:id="@+id/tv_end"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:paddingRight="6dp"
android:background="?attr/editTextBackground"
android:gravity="bottom"
android:layout_height="match_parent"
android:id="@+id/tv_end"
android:textSize="20sp"
android:hint="To "
android:paddingRight="6dp"
android:background="?attr/editTextBackground"
android:paddingTop="8dp"/>
android:paddingTop="8dp"
android:textSize="20sp" />
</LinearLayout>
<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_marginLeft="15dp"
android:layout_marginRight="16dp"
android:layout_marginTop="10dp"
android:textSize="20sp"
android:id="@+id/et_venue"
android:hint="Venue"/>
android:hint="Venue"
android:paddingRight="6dp"
android:textSize="20sp" />
<EditText
android:id="@+id/et_eventDetails"
......@@ -111,72 +111,75 @@
android:layout_marginTop="8dp"
android:layout_weight="1"
android:gravity="top"
android:textSize="20sp"
android:hint="Details"
android:paddingRight="6dp" />
android:paddingRight="6dp"
android:textSize="20sp" />
<RelativeLayout
android:id="@+id/advanced_menu"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/advanced_menu">
android:layout_height="wrap_content">
<TextView android:layout_height="30dp"
<TextView
android:layout_width="wrap_content"
android:text="Advanced Options"
android:layout_height="30dp"
android:paddingLeft="18dp"
android:textSize="20sp"
android:paddingRight="16dp"/>
android:paddingRight="16dp"
android:text="Advanced Options"
android:textSize="20sp" />
<ImageView
android:id="@+id/close"
android:layout_width="wrap_content"
android:layout_height="30dp"
android:layout_alignParentEnd="true"
android:id="@+id/close"
android:src="@mipmap/advanced_menu_close"/>
android:src="@mipmap/advanced_menu_close" />
<ImageView
android:id="@+id/open"
android:layout_width="wrap_content"
android:layout_height="30dp"
android:id="@+id/open"
android:layout_alignParentEnd="true"
android:src="@mipmap/advanced_menu_open"/>
android:src="@mipmap/advanced_menu_open" />
</RelativeLayout>
<CheckBox
android:id="@+id/cb_public"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/cb_public"
android:layout_marginLeft="20dp"
android:layout_marginRight="12dp"
android:text="Outsiders Allowed "/>
android:text="Outsiders Allowed " />
<EditText
android:id="@+id/map_location"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/map_location"
android:layout_marginLeft="22dp"
android:layout_marginRight="12dp"
android:hint="Map Location"/>
android:hint="Map Location" />
<CheckBox
android:id="@+id/cb_permission"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Request User Info"
android:layout_marginLeft="20dp"
android:layout_marginRight="12dp"
android:id="@+id/cb_permission"/>
android:text="Request User Info" />
</LinearLayout>
</ScrollView>
<Button
android:id="@+id/button_createEvent"
android:layout_width="match_parent"
android:layout_height="40dp"
android:text="Create"
android:layout_margin="8dp"
android:background="@drawable/round_text_box"
android:id="@+id/button_createEvent"
android:gravity="center"/>
android:gravity="center"
android:text="Create" />
</LinearLayout>
\ No newline at end of file
<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"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"
tools:context="in.ac.iitb.gymkhana.iitbapp.fragment.EventFragment">
......@@ -10,82 +10,88 @@
android:id="@+id/event_picture_2"
android:layout_width="match_parent"
android:layout_height="0dp"
android:scaleType="centerCrop"
android:layout_weight="1"/>
android:layout_weight="1"
android:scaleType="centerCrop" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:orientation="vertical">
<android.support.v7.widget.CardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:cardBackgroundColor="@color/colorPrimary">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="3"
android:orientation="vertical"
android:layout_gravity="center_vertical"
android:layout_marginRight="16dp"
android:layout_marginBottom="12dp"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:layout_marginTop="12dp"
android:layout_marginBottom="12dp">
android:layout_weight="3"
android:orientation="vertical">
<TextView
android:id="@+id/event_page_title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textSize="28sp"
android:text="Event Title"
android:textColor="#fff"
android:text="Event Title"/>
android:textSize="28sp" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:id="@+id/event_page_date"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/event_page_date"
android:text="26 May"
android:textSize="16sp"
android:textColor="#fff"/>
android:text="No Date Specified"
android:textColor="#fff"
android:textSize="16sp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=" | "
android:textSize="20sp"
android:textColor="#fff"/>
android:textColor="#fff"
android:textSize="20sp" />
<TextView
android:id="@+id/event_page_time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/event_page_time"
android:text="6:00 PM"
android:textSize="16sp"
android:textColor="#fff"/>
android:text="No Time Specified"
android:textColor="#fff"
android:textSize="16sp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=" | "
android:textSize="20sp"
android:textColor="#fff"/>
android:textColor="#fff"
android:textSize="20sp" />
<TextView
android:id="@+id/event_page_venue"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/event_page_venue"
android:text="LH 101"
android:ellipsize="end"
android:textSize="16sp"
android:textColor="#fff"/>
android:text="No Venue Specified"
android:textColor="#fff"
android:textSize="16sp" />
</LinearLayout>
</LinearLayout>
</android.support.v7.widget.CardView>
<LinearLayout
style="?android:attr/buttonBarStyle"
android:layout_width="match_parent"
......@@ -93,56 +99,61 @@
android:orientation="horizontal">
<Button
android:id="@+id/going_button"
style="?android:attr/buttonBarButtonStyle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_margin="0dp"
android:layout_weight="1"
android:text="Going"
android:layout_margin="0dp"
android:textColor="@color/colorGray"/>
android:textColor="@color/colorGray" />
<View
android:layout_width="1dp"
android:layout_height="match_parent"
android:background="#aaa"
android:layout_marginBottom="6dp"
android:layout_marginTop="10dp"
android:layout_marginBottom="6dp">
android:background="#aaa">
</View>
<Button
android:id="@+id/interested_button"
style="?android:attr/buttonBarButtonStyle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_margin="0dp"
android:layout_weight="1"
android:text="Interested"
android:layout_margin="0dp"
android:textColor="@color/colorGray"/>
android:textColor="@color/colorGray" />
<View
android:layout_width="1dp"
android:layout_height="match_parent"
android:background="#aaa"
android:layout_marginBottom="6dp"
android:layout_marginTop="10dp"
android:layout_marginBottom="6dp">
android:background="#aaa">
</View>
<Button
android:id="@+id/not_going_button"
style="?android:attr/buttonBarButtonStyle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_margin="0dp"
android:layout_weight="1"
android:text="Not Going"
android:layout_margin="0dp"
android:textColor="@color/colorGray"/>
android:textColor="@color/colorGray" />
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="#aaa"
android:layout_marginBottom="6dp"
android:layout_marginLeft="6dp"
android:layout_marginRight="6dp">
android:layout_marginRight="6dp"
android:background="#aaa">
</View>
......@@ -150,10 +161,10 @@
android:id="@+id/event_page_description"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:layout_marginTop="8dp"
android:textColor="#777"
android:textSize="16sp"/>
android:textSize="16sp" />
</LinearLayout>
</LinearLayout>
<android.support.v4.widget.SwipeRefreshLayout xmlns:android="http://schemas.android.com/apk/res/android"
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/feed_swipe_refresh_layout"
android:id="@+id/relative_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="in.ac.iitb.gymkhana.iitbapp.fragment.FeedFragment">
android:layout_height="match_parent">
<android.support.v7.widget.RecyclerView
android:id="@+id/feed_recycler_view"
<android.support.v4.widget.SwipeRefreshLayout
android:id="@+id/feed_swipe_refresh_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingTop="8dp"/>
tools:context="in.ac.iitb.gymkhana.iitbapp.fragment.FeedFragment">
</android.support.v4.widget.SwipeRefreshLayout>
<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.design.widget.FloatingActionButton
android:id="@+id/fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:layout_margin="16dp"
android:src="@android:drawable/ic_input_add" />
</RelativeLayout>
\ No newline at end of file
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/relative_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="in.ac.iitb.gymkhana.iitbapp.fragment.MyEventsFragment">
android:layout_height="match_parent">
<!-- TODO: Update blank fragment layout -->
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="@string/hello_blank_fragment" />
</FrameLayout>
<android.support.design.widget.FloatingActionButton
android:id="@+id/fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:layout_margin="16dp"
android:src="@android:drawable/ic_input_add" />
</RelativeLayout>
......@@ -6,45 +6,45 @@
tools:context="in.ac.iitb.gymkhana.iitbapp.fragment.ProfileFragment">
<de.hdodenhof.circleimageview.CircleImageView
android:layout_margin="32dp"
android:id="@+id/user_profile_picture_profile"
android:layout_width="160dp"
android:layout_height="160dp" />
android:layout_height="160dp"
android:layout_margin="32dp" />
<LinearLayout
android:layout_marginTop="32dp"
android:orientation="vertical"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
android:layout_height="wrap_content"
android:layout_marginTop="32dp"
android:orientation="vertical">
<TextView
android:textSize="20sp"
android:layout_marginBottom="2dp"
android:id="@+id/user_name_profile"
android:textStyle="bold"
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
android:textSize="16sp"
android:layout_marginBottom="2dp"
android:id="@+id/user_rollno_profile"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
android:layout_height="wrap_content"
android:layout_marginBottom="2dp"
android:textSize="16sp" />
<TextView
android:textSize="16sp"
android:layout_marginBottom="2dp"
android:id="@+id/user_email_profile"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
android:layout_height="wrap_content"
android:layout_marginBottom="2dp"
android:textSize="16sp" />
<TextView
android:textSize="16sp"
android:layout_marginBottom="2dp"
android:id="@+id/user_contact_no_profile"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
android:layout_height="wrap_content"
android:layout_marginBottom="2dp"
android:textSize="16sp" />
</LinearLayout>
</LinearLayout>
......@@ -5,4 +5,5 @@
<color name="colorAccent">#ECF833</color>
<color name="colorCalendarWeek">#000000</color>
<color name="colorGray">#757575</color>
<color name="colorWhite">#FFFFFF</color>
</resources>
......@@ -9,7 +9,7 @@ buildscript {
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
classpath 'com.android.tools.build:gradle:3.1.0'
classpath 'com.google.gms:google-services:3.1.0'
// NOTE: Do not place your application dependencies here; they belong
......
#Fri Sep 22 00:09:34 IST 2017
#Wed Mar 28 12:02:24 IST 2018
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment