Commit 6c4d043c authored by Varun Patil's avatar Varun Patil

Implement AddEvent using WebView

parent a5e845c3
...@@ -19,6 +19,7 @@ import android.view.Menu; ...@@ -19,6 +19,7 @@ import android.view.Menu;
import android.view.MenuItem; import android.view.MenuItem;
import android.view.View; import android.view.View;
import android.view.inputmethod.InputMethodManager; import android.view.inputmethod.InputMethodManager;
import android.webkit.WebChromeClient;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.TextView; import android.widget.TextView;
import android.widget.Toast; import android.widget.Toast;
......
...@@ -9,6 +9,7 @@ import app.insti.api.model.ImageUploadRequest; ...@@ -9,6 +9,7 @@ import app.insti.api.model.ImageUploadRequest;
import app.insti.api.model.ImageUploadResponse; import app.insti.api.model.ImageUploadResponse;
import app.insti.api.model.LoginResponse; import app.insti.api.model.LoginResponse;
import app.insti.api.model.NewsFeedResponse; import app.insti.api.model.NewsFeedResponse;
import app.insti.data.Event;
import app.insti.data.HostelMessMenu; import app.insti.data.HostelMessMenu;
import app.insti.data.NewsArticle; import app.insti.data.NewsArticle;
import app.insti.data.Notification; import app.insti.data.Notification;
...@@ -37,6 +38,9 @@ public interface RetrofitInterface { ...@@ -37,6 +38,9 @@ public interface RetrofitInterface {
@POST("events") @POST("events")
Call<EventCreateResponse> createEvent(@Header("Cookie") String sessionId, @Body EventCreateRequest eventCreateRequest); Call<EventCreateResponse> createEvent(@Header("Cookie") String sessionId, @Body EventCreateRequest eventCreateRequest);
@GET("events/{uuid}")
Call<Event> getEvent(@Header("Cookie") String sessionId, @Path("uuid") String uuid);
@GET("events") @GET("events")
Call<NewsFeedResponse> getNewsFeed(@Header("Cookie") String sessionId); Call<NewsFeedResponse> getNewsFeed(@Header("Cookie") String sessionId);
......
...@@ -75,11 +75,12 @@ public class FeedFragment extends BaseFragment { ...@@ -75,11 +75,12 @@ public class FeedFragment extends BaseFragment {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
AddEventFragment addEventFragment = new AddEventFragment(); AddEventFragment addEventFragment = new AddEventFragment();
addEventFragment.setArguments(getArguments()); Bundle bundle = new Bundle();
addEventFragment.setArguments(bundle);
FragmentTransaction ft = getChildFragmentManager().beginTransaction(); FragmentTransaction ft = getChildFragmentManager().beginTransaction();
ft.setCustomAnimations(R.anim.slide_in_left, R.anim.slide_out_left, R.anim.slide_in_right, R.anim.slide_out_right); ft.setCustomAnimations(R.anim.slide_in_left, R.anim.slide_out_left, R.anim.slide_in_right, R.anim.slide_out_right);
ft.replace(R.id.relative_layout, addEventFragment); ft.replace(R.id.relative_layout, addEventFragment, addEventFragment.getTag());
ft.addToBackStack("addEvent"); ft.addToBackStack(addEventFragment.getTag());
ft.commit(); ft.commit();
} }
}); });
...@@ -89,10 +90,9 @@ public class FeedFragment extends BaseFragment { ...@@ -89,10 +90,9 @@ public class FeedFragment extends BaseFragment {
@Override @Override
public void onStart() { public void onStart() {
super.onStart(); super.onStart();
fab.setVisibility(View.VISIBLE);
if (((MainActivity) getActivity()).createEventAccess()) { if (((MainActivity) getActivity()).createEventAccess()) {
/* TODO: Uncomment the following line when Add Event is completed */ fab.setVisibility(View.VISIBLE);
// fab.setVisibility(View.VISIBLE);
} }
appDatabase = AppDatabase.getAppDatabase(getContext()); appDatabase = AppDatabase.getAppDatabase(getContext());
......
...@@ -5,183 +5,11 @@ ...@@ -5,183 +5,11 @@
android:orientation="vertical" android:orientation="vertical"
tools:context="app.insti.fragment.AddEventFragment"> tools:context="app.insti.fragment.AddEventFragment">
<ScrollView <WebView
android:id="@+id/add_event_webview"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="0dp" android:layout_height="match_parent">
android:layout_weight="1">
<LinearLayout </WebView>
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="200dp">
<ImageView
android:id="@+id/iv_eventImage"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#EEEEEE" />
<ImageButton
android:id="@+id/ib_eventImage"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#EEEEEE"
android:src="@drawable/ic_input_add"
android:tint="@android:color/black" />
</RelativeLayout>
<EditText
android:id="@+id/et_eventName"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/colorPrimary"
android:hint="Event Name"
android:padding="16dp"
android:paddingBottom="16dp"
android:textColorHint="#FFFFFF"
/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="40dp"
android:layout_marginLeft="15dp"
android:layout_marginRight="16dp"
android:layout_marginTop="10dp"
android:orientation="horizontal">
<TextView
android:id="@+id/tv_start"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="?attr/editTextBackground"
android:gravity="bottom"
android:hint="From "
android:paddingRight="6dp"
android:paddingTop="8dp"
android:textSize="20sp" />
<View
android:layout_width="3dp"
android:layout_height="match_parent"
android:layout_marginBottom="5dp"
android:layout_marginTop="5dp"
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:background="?attr/editTextBackground"
android:enabled="false"
android:gravity="bottom"
android:hint="To "
android:paddingRight="6dp"
android:paddingTop="8dp"
android:textSize="20sp" />
</LinearLayout>
<EditText
android:id="@+id/et_venue"
android:layout_width="match_parent"
android:layout_height="40dp"
android:layout_marginLeft="15dp"
android:layout_marginRight="16dp"
android:layout_marginTop="10dp"
android:hint="Venue"
android:paddingRight="6dp"
android:textSize="20sp" />
<EditText
android:id="@+id/et_eventDetails"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_marginLeft="15dp"
android:layout_marginRight="16dp"
android:layout_marginTop="8dp"
android:layout_weight="1"
android:gravity="top"
android:hint="Details"
android:paddingRight="6dp"
android:textSize="20sp" />
<RelativeLayout
android:id="@+id/advanced_menu"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:layout_width="wrap_content"
android:layout_height="30dp"
android:paddingLeft="18dp"
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:src="@mipmap/advanced_menu_close" />
<ImageView
android:id="@+id/open"
android:layout_width="wrap_content"
android:layout_height="30dp"
android:layout_alignParentEnd="true"
android:src="@mipmap/advanced_menu_open" />
</RelativeLayout>
<CheckBox
android:id="@+id/cb_public"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="20dp"
android:layout_marginRight="12dp"
android:text="Outsiders Allowed " />
<EditText
android:id="@+id/map_location"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="22dp"
android:layout_marginRight="12dp"
android:hint="Map Location" />
<CheckBox
android:id="@+id/cb_permission"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="20dp"
android:layout_marginRight="12dp"
android:text="Request User Info" />
</LinearLayout>
</ScrollView>
<Button
android:id="@+id/button_createEvent"
android:layout_width="match_parent"
android:layout_height="40dp"
android:layout_margin="8dp"
android:background="@drawable/round_text_box"
android:gravity="center"
android:text="Create" />
</LinearLayout> </LinearLayout>
\ No newline at end of file
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