Commit 903fd124 authored by Sajal Narang's avatar Sajal Narang

Implement navigation

parent ecc5387e
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
<modules> <modules>
<module fileurl="file://$PROJECT_DIR$/IITB-App.iml" filepath="$PROJECT_DIR$/IITB-App.iml" /> <module fileurl="file://$PROJECT_DIR$/IITB-App.iml" filepath="$PROJECT_DIR$/IITB-App.iml" />
<module fileurl="file://$PROJECT_DIR$/IITBApp.iml" filepath="$PROJECT_DIR$/IITBApp.iml" /> <module fileurl="file://$PROJECT_DIR$/IITBApp.iml" filepath="$PROJECT_DIR$/IITBApp.iml" />
<module fileurl="file://$PROJECT_DIR$/InstiApp.iml" filepath="$PROJECT_DIR$/InstiApp.iml" />
<module fileurl="file://$PROJECT_DIR$/app/app.iml" filepath="$PROJECT_DIR$/app/app.iml" /> <module fileurl="file://$PROJECT_DIR$/app/app.iml" filepath="$PROJECT_DIR$/app/app.iml" />
</modules> </modules>
</component> </component>
......
...@@ -51,9 +51,9 @@ public class EventFragment extends BaseFragment { ...@@ -51,9 +51,9 @@ public class EventFragment extends BaseFragment {
Event event; Event event;
Button goingButton; Button goingButton;
Button interestedButton; Button interestedButton;
Button notGoingButton; ImageButton navigateButton;
ImageButton shareEventButton;
ImageButton webEventButton; ImageButton webEventButton;
ImageButton shareEventButton;
RecyclerView bodyRecyclerView; RecyclerView bodyRecyclerView;
private AppDatabase appDatabase; private AppDatabase appDatabase;
String TAG = "EventFragment"; String TAG = "EventFragment";
...@@ -93,8 +93,9 @@ public class EventFragment extends BaseFragment { ...@@ -93,8 +93,9 @@ public class EventFragment extends BaseFragment {
TextView eventDescription = (TextView) getActivity().findViewById(R.id.event_page_description); TextView eventDescription = (TextView) getActivity().findViewById(R.id.event_page_description);
goingButton = getActivity().findViewById(R.id.going_button); goingButton = getActivity().findViewById(R.id.going_button);
interestedButton = getActivity().findViewById(R.id.interested_button); interestedButton = getActivity().findViewById(R.id.interested_button);
shareEventButton = getActivity().findViewById(R.id.share_event_button); navigateButton = getActivity().findViewById(R.id.navigate_button);
webEventButton = getActivity().findViewById(R.id.web_event_button); webEventButton = getActivity().findViewById(R.id.web_event_button);
shareEventButton = getActivity().findViewById(R.id.share_event_button);
Picasso.with(getContext()).load(event.getEventImageURL()).into(eventPicture); Picasso.with(getContext()).load(event.getEventImageURL()).into(eventPicture);
eventTitle.setText(event.getEventName()); eventTitle.setText(event.getEventName());
...@@ -111,21 +112,22 @@ public class EventFragment extends BaseFragment { ...@@ -111,21 +112,22 @@ public class EventFragment extends BaseFragment {
eventVenueName.append(", ").append(venue.getVenueShortName()); eventVenueName.append(", ").append(venue.getVenueShortName());
} }
final List<Body> bodyList = event.getEventBodies(); final List<Body> bodyList = event.getEventBodies();
bodyRecyclerView = (RecyclerView) getActivity().findViewById(R.id.body_card_recycler_view); bodyRecyclerView = (RecyclerView) getActivity().findViewById(R.id.body_card_recycler_view);
BodyAdapter bodyAdapter = new BodyAdapter(bodyList, new ItemClickListener() { BodyAdapter bodyAdapter = new BodyAdapter(bodyList, new ItemClickListener() {
@Override @Override
public void onItemClick(View v, int position) { public void onItemClick(View v, int position) {
Body body = bodyList.get(position); Body body = bodyList.get(position);
BodyFragment bodyFragment = BodyFragment.newInstance(body); BodyFragment bodyFragment = BodyFragment.newInstance(body);
FragmentTransaction ft = getActivity().getSupportFragmentManager().beginTransaction(); FragmentTransaction ft = getActivity().getSupportFragmentManager().beginTransaction();
ft.replace(R.id.framelayout_for_fragment, bodyFragment, bodyFragment.getTag()); ft.setCustomAnimations(R.anim.slide_in_left, R.anim.slide_out_left, R.anim.slide_in_right, R.anim.slide_out_right);
ft.addToBackStack(bodyFragment.getTag()); ft.replace(R.id.framelayout_for_fragment, bodyFragment, bodyFragment.getTag());
ft.commit(); ft.addToBackStack(bodyFragment.getTag());
} ft.commit();
}); }
bodyRecyclerView.setAdapter(bodyAdapter); });
bodyRecyclerView.setLayoutManager(new LinearLayoutManager(getContext())); bodyRecyclerView.setAdapter(bodyAdapter);
bodyRecyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
if (!eventVenueName.toString().equals("")) if (!eventVenueName.toString().equals(""))
...@@ -138,8 +140,20 @@ public class EventFragment extends BaseFragment { ...@@ -138,8 +140,20 @@ public class EventFragment extends BaseFragment {
interestedButton.setBackgroundColor(getResources().getColor(event.getEventUserUes() == Constants.STATUS_INTERESTED ? R.color.colorAccent : R.color.colorWhite)); interestedButton.setBackgroundColor(getResources().getColor(event.getEventUserUes() == Constants.STATUS_INTERESTED ? R.color.colorAccent : R.color.colorWhite));
goingButton.setBackgroundColor(getResources().getColor(event.getEventUserUes() == Constants.STATUS_GOING ? R.color.colorAccent : R.color.colorWhite)); goingButton.setBackgroundColor(getResources().getColor(event.getEventUserUes() == Constants.STATUS_GOING ? R.color.colorAccent : R.color.colorWhite));
navigateButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Venue primaryVenue = event.getEventVenues().get(0);
Uri gmmIntentUri = Uri.parse("google.navigation:q=" + primaryVenue.getVenueLatitude() + "," + primaryVenue.getVenueLongitude() + "(" + primaryVenue.getVenueName() + ")");
Intent mapIntent = new Intent(Intent.ACTION_VIEW, gmmIntentUri);
mapIntent.setPackage("com.google.android.apps.maps");
startActivity(mapIntent);
}
});
shareEventButton.setOnClickListener(new View.OnClickListener() { shareEventButton.setOnClickListener(new View.OnClickListener() {
String shareUrl = ShareURLMaker.getEventURL(event); String shareUrl = ShareURLMaker.getEventURL(event);
@Override @Override
public void onClick(View view) { public void onClick(View view) {
Intent i = new Intent(Intent.ACTION_SEND); Intent i = new Intent(Intent.ACTION_SEND);
...@@ -149,18 +163,18 @@ public class EventFragment extends BaseFragment { ...@@ -149,18 +163,18 @@ public class EventFragment extends BaseFragment {
startActivity(Intent.createChooser(i, "Share URL")); startActivity(Intent.createChooser(i, "Share URL"));
} }
}); });
if (event.getEventWebsiteURL() != null && !event.getEventWebsiteURL().isEmpty()) if (event.getEventWebsiteURL() != null && !event.getEventWebsiteURL().isEmpty()) {
{ webEventButton.setVisibility(View.VISIBLE);
webEventButton.setVisibility(View.VISIBLE); webEventButton.setOnClickListener(new View.OnClickListener() {
webEventButton.setOnClickListener(new View.OnClickListener() { String eventwebURL = event.getEventWebsiteURL();
String eventwebURL = event.getEventWebsiteURL();
@Override @Override
public void onClick(View view) { public void onClick(View view) {
Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(eventwebURL)); Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(eventwebURL));
startActivity(browserIntent); startActivity(browserIntent);
} }
}); });
} }
} }
View.OnClickListener getUESOnClickListener(final int status) { View.OnClickListener getUESOnClickListener(final int status) {
......
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0"
android:tint="?attr/colorControlNormal">
<path
android:fillColor="@android:color/white"
android:pathData="M12,2L4.5,20.29l0.71,0.71L12,18l6.79,3 0.71,-0.71z"/>
</vector>
...@@ -57,24 +57,35 @@ ...@@ -57,24 +57,35 @@
<ImageButton <ImageButton
android:id="@+id/web_event_button" android:id="@+id/web_event_button"
android:layout_width="10dp" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center_vertical" android:layout_gravity="center_vertical"
android:layout_weight="1"
android:background="?attr/selectableItemBackgroundBorderless" android:background="?attr/selectableItemBackgroundBorderless"
android:contentDescription="Event Website" android:contentDescription="Event Website"
android:src="@drawable/ic_language_black_24dp" android:layout_marginStart="8dp"
app:srcCompat="@drawable/ic_language_black_24dp"
android:tint="@color/colorWhite" android:tint="@color/colorWhite"
android:visibility="invisible"/> android:visibility="invisible"/>
<ImageButton
android:id="@+id/navigate_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:background="?attr/selectableItemBackgroundBorderless"
android:contentDescription="Navigate"
android:layout_marginStart="8dp"
app:srcCompat="@drawable/baseline_navigation_24"
android:tint="@color/colorWhite" />
<ImageButton <ImageButton
android:id="@+id/share_event_button" android:id="@+id/share_event_button"
android:layout_width="0dp" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center_vertical" android:layout_gravity="center_vertical"
android:layout_weight="1"
android:background="?attr/selectableItemBackgroundBorderless" android:background="?attr/selectableItemBackgroundBorderless"
android:contentDescription="Share Event" android:contentDescription="Share Event"
android:layout_marginStart="8dp"
android:src="@drawable/ic_menu_share" android:src="@drawable/ic_menu_share"
android:tint="@color/colorWhite" /> android:tint="@color/colorWhite" />
</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