Commit 67138833 authored by Sajal Narang's avatar Sajal Narang

Reformat code, fix #63

parent 98d307da
<?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" />
......
......@@ -5,59 +5,68 @@ 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. */
/**
* A class which maintains a list of transactions to occur when Context becomes available.
*/
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;
/* Member Variables. */
private Activity mActivity;
/** Constructor. */
/**
* Constructor.
*/
public ActivityBuffer() {
// Initialize Member Variables.
this.mActivity = null;
this.mActivity = null;
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) {
// Synchronize along the current instance.
synchronized(this) {
synchronized (this) {
// Do we have a context available?
if(this.isContextAvailable()) {
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 {
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. */
/**
* Called to inform the ActivityBuffer that there's an available Activity reference.
*/
public final void onContextGained(final Activity pActivity) {
// Synchronize along ourself.
synchronized(this) {
synchronized (this) {
// Update the Activity reference.
this.setActivity(pActivity);
// Are there any Runnables awaiting execution?
if(!this.getRunnables().isEmpty()) {
if (!this.getRunnables().isEmpty()) {
// Iterate the Runnables.
for(final IRunnable lRunnable : this.getRunnables()) {
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);
} });
pActivity.runOnUiThread(new Runnable() {
@Override
public final void run() {
// Execute the Runnable.
lRunnable.run(pActivity);
}
});
}
// Empty the Runnables.
this.getRunnables().clear();
......@@ -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() {
// Synchronize along ourself.
synchronized(this) {
synchronized (this) {
// Remove the Context reference.
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() {
// Synchronize upon ourself.
synchronized(this) {
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 Activity getActivity() {
return this.mActivity;
}
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,10 +3,18 @@ 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 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;
......
......@@ -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;
......@@ -26,9 +25,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;
......@@ -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.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
......@@ -60,9 +52,9 @@ public class MainActivity extends AppCompatActivity
private static final String TAG = "MainActivity";
private User currentUser;
SessionManager session;
NotificationsResponse notificationsResponse;
private User currentUser;
private boolean showNotifications = false;
@Override
......@@ -92,7 +84,7 @@ public class MainActivity extends AppCompatActivity
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();
}
}
......@@ -259,7 +251,7 @@ public class MainActivity extends AppCompatActivity
private void updateFragment(Fragment fragment) {
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);
FragmentManager manager = getSupportFragmentManager();
FragmentTransaction transaction = manager.beginTransaction();
......
......@@ -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);
}
}
......@@ -66,7 +66,7 @@ public class FeedAdapter extends RecyclerView.Adapter<FeedAdapter.ViewHolder> {
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
......@@ -77,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;
......
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);
}
}
......@@ -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,10 +50,8 @@ 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 BaseFragment {
......@@ -93,12 +91,23 @@ public class AddEventFragment extends BaseFragment {
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 BaseFragment {
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 BaseFragment {
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 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
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
......
......@@ -3,16 +3,9 @@ package in.ac.iitb.gymkhana.iitbapp.fragment;
import android.app.Activity;
import android.content.Context;
import android.os.Bundle;
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.R;
/**
* A simple {@link Fragment} subclass.
......@@ -34,15 +27,16 @@ public class BaseFragment extends Fragment {
// Handle as usual.
super.onAttach(pContext);
// Is the Context an Activity?
if(pContext instanceof Activity) {
if (pContext instanceof Activity) {
// Cast Accordingly.
final Activity lActivity = (Activity)pContext;
final Activity lActivity = (Activity) pContext;
// Inform the ActivityBuffer.
this.getActivityBuffer().onContextGained(lActivity);
}
}
@Deprecated @Override
@Deprecated
@Override
public final void onAttach(final Activity pActivity) {
// Handle as usual.
super.onAttach(pActivity);
......
......@@ -29,9 +29,6 @@ import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
import static android.content.ContentValues.TAG;
import static in.ac.iitb.gymkhana.iitbapp.SessionManager.SESSION_ID;
/**
* A simple {@link Fragment} subclass.
*/
......@@ -40,6 +37,7 @@ public class EventFragment extends BaseFragment implements View.OnClickListener
Button goingButton;
Button interestedButton;
Button notGoingButton;
String TAG = "EventFragment";
public EventFragment() {
// Required empty public constructor
......@@ -115,7 +113,7 @@ public class EventFragment extends BaseFragment implements View.OnClickListener
break;
}
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
public void onResponse(Call<Void> call, Response<Void> response) {
if (response.isSuccessful()) {
......
......@@ -32,8 +32,6 @@ import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
import static in.ac.iitb.gymkhana.iitbapp.SessionManager.SESSION_ID;
/**
* A simple {@link Fragment} subclass.
*/
......@@ -54,9 +52,9 @@ public class FeedFragment extends BaseFragment {
Bundle savedInstanceState) {
// 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() {
@Override
......@@ -93,7 +91,7 @@ public class FeedFragment extends BaseFragment {
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()) {
......
......@@ -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,6 +46,7 @@ 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;
......@@ -65,7 +62,6 @@ public class MapFragment extends BaseFragment implements OnMapReadyCallback, Loc
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 BaseFragment implements OnMapReadyCallback, Loc
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 BaseFragment implements OnMapReadyCallback, Loc
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 BaseFragment implements OnMapReadyCallback, Loc
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 BaseFragment implements OnMapReadyCallback, Loc
}
} 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 BaseFragment implements OnMapReadyCallback, Loc
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 BaseFragment implements OnMapReadyCallback, Loc
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 BaseFragment implements OnMapReadyCallback, Loc
} 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 BaseFragment implements OnMapReadyCallback, Loc
.build();
mGoogleApiClient.connect();
}
@Override
public void onLocationChanged(Location location) {
mLastLocation = location;
......@@ -298,13 +298,14 @@ public class MapFragment extends BaseFragment implements OnMapReadyCallback, Loc
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 BaseFragment implements OnMapReadyCallback, Loc
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 BaseFragment implements OnMapReadyCallback, Loc
}
}
}
@Override
public void onConnectionFailed(ConnectionResult connectionResult) {
}
......@@ -345,5 +347,4 @@ public class MapFragment extends BaseFragment implements OnMapReadyCallback, Loc
}
}
......@@ -27,10 +27,10 @@ public class MyEventsFragment extends BaseFragment {
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// 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() {
@Override
......
......@@ -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,8 +20,6 @@ import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
import static in.ac.iitb.gymkhana.iitbapp.SessionManager.SESSION_ID;
/**
* A simple {@link Fragment} subclass.
*/
......@@ -47,7 +45,7 @@ public class ProfileFragment extends BaseFragment {
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()) {
......
......@@ -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="No Date Specified"
android:textSize="16sp"
android:textColor="#fff"/>
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="No Time Specified"
android:textSize="16sp"
android:textColor="#fff"/>
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="No Venue Specified"
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"
......@@ -97,16 +103,17 @@
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>
......@@ -115,16 +122,17 @@
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>
......@@ -133,19 +141,19 @@
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>
......@@ -153,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>
<RelativeLayout android:layout_height="match_parent"
android:layout_width="match_parent"
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
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_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.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:id="@+id/fab"
......
<RelativeLayout android:layout_height="match_parent"
android:layout_width="match_parent"
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
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:id="@+id/fab"
android:layout_width="wrap_content"
......
......@@ -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>
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