Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
I
InstiApp
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
RAHUL SHARMA
InstiApp
Commits
1c32c302
Commit
1c32c302
authored
Jul 31, 2018
by
Sajal Narang
Committed by
GitHub
Jul 31, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #158 from pulsejet/addevent
Implement Add Event
parents
439eef59
cc8e5c3f
Changes
15
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
435 additions
and
668 deletions
+435
-668
app/src/main/java/app/insti/MainActivity.java
app/src/main/java/app/insti/MainActivity.java
+20
-0
app/src/main/java/app/insti/api/RetrofitInterface.java
app/src/main/java/app/insti/api/RetrofitInterface.java
+4
-0
app/src/main/java/app/insti/fragment/AddEventFragment.java
app/src/main/java/app/insti/fragment/AddEventFragment.java
+142
-288
app/src/main/java/app/insti/fragment/CalendarFragment.java
app/src/main/java/app/insti/fragment/CalendarFragment.java
+1
-2
app/src/main/java/app/insti/fragment/EventFragment.java
app/src/main/java/app/insti/fragment/EventFragment.java
+27
-0
app/src/main/java/app/insti/fragment/FeedFragment.java
app/src/main/java/app/insti/fragment/FeedFragment.java
+24
-21
app/src/main/java/app/insti/fragment/MyEventsFragment.java
app/src/main/java/app/insti/fragment/MyEventsFragment.java
+2
-7
app/src/main/res/drawable/ic_add_black_24dp.xml
app/src/main/res/drawable/ic_add_black_24dp.xml
+9
-0
app/src/main/res/drawable/ic_edit_black_24dp.xml
app/src/main/res/drawable/ic_edit_black_24dp.xml
+9
-0
app/src/main/res/layout/fragment_add_event.xml
app/src/main/res/layout/fragment_add_event.xml
+5
-176
app/src/main/res/layout/fragment_calendar.xml
app/src/main/res/layout/fragment_calendar.xml
+1
-1
app/src/main/res/layout/fragment_event.xml
app/src/main/res/layout/fragment_event.xml
+189
-170
app/src/main/res/layout/fragment_feed.xml
app/src/main/res/layout/fragment_feed.xml
+1
-1
app/src/main/res/layout/fragment_my_events.xml
app/src/main/res/layout/fragment_my_events.xml
+1
-1
app/src/main/res/values/drawables.xml
app/src/main/res/values/drawables.xml
+0
-1
No files found.
app/src/main/java/app/insti/MainActivity.java
View file @
1c32c302
...
@@ -24,6 +24,7 @@ import android.view.Menu;
...
@@ -24,6 +24,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
;
...
@@ -37,6 +38,8 @@ import app.insti.api.RetrofitInterface;
...
@@ -37,6 +38,8 @@ import app.insti.api.RetrofitInterface;
import
app.insti.api.ServiceGenerator
;
import
app.insti.api.ServiceGenerator
;
import
app.insti.api.UnsafeOkHttpClient
;
import
app.insti.api.UnsafeOkHttpClient
;
import
app.insti.data.Body
;
import
app.insti.data.Body
;
import
app.insti.data.Event
;
import
app.insti.data.Role
;
import
app.insti.data.User
;
import
app.insti.data.User
;
import
app.insti.fragment.BackHandledFragment
;
import
app.insti.fragment.BackHandledFragment
;
import
app.insti.fragment.BodyFragment
;
import
app.insti.fragment.BodyFragment
;
...
@@ -452,6 +455,23 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
...
@@ -452,6 +455,23 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
return
true
;
return
true
;
}
}
public
boolean
editEventAccess
(
Event
event
)
{
if
(
currentUser
==
null
||
currentUser
.
getUserRoles
()
==
null
||
currentUser
.
getUserRoles
().
size
()
==
0
)
return
false
;
for
(
Role
role
:
currentUser
.
getUserRoles
())
{
for
(
Body
body
:
role
.
getRoleBodies
())
{
for
(
Body
eventBody
:
event
.
getEventBodies
())
{
if
(
body
.
getBodyID
().
equals
(
eventBody
.
getBodyID
()))
{
return
true
;
}
}
}
}
return
false
;
}
public
static
void
hideKeyboard
(
Activity
activity
)
{
public
static
void
hideKeyboard
(
Activity
activity
)
{
InputMethodManager
imm
=
(
InputMethodManager
)
activity
.
getSystemService
(
Activity
.
INPUT_METHOD_SERVICE
);
InputMethodManager
imm
=
(
InputMethodManager
)
activity
.
getSystemService
(
Activity
.
INPUT_METHOD_SERVICE
);
//Find the currently focused view, so we can grab the correct window token from it.
//Find the currently focused view, so we can grab the correct window token from it.
...
...
app/src/main/java/app/insti/api/RetrofitInterface.java
View file @
1c32c302
...
@@ -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
;
...
@@ -40,6 +41,9 @@ public interface RetrofitInterface {
...
@@ -40,6 +41,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
);
...
...
app/src/main/java/app/insti/fragment/AddEventFragment.java
View file @
1c32c302
package
app.insti.fragment
;
package
app.insti.fragment
;
import
android.Manifest
;
import
android.app.DatePickerDialog
;
import
android.app.ProgressDialog
;
import
android.app.ProgressDialog
;
import
android.
app.TimePickerDialog
;
import
android.
content.ActivityNotFoundException
;
import
android.content.Intent
;
import
android.content.Intent
;
import
android.content.pm.PackageManager
;
import
android.database.Cursor
;
import
android.graphics.Bitmap
;
import
android.graphics.BitmapFactory
;
import
android.net.Uri
;
import
android.net.Uri
;
import
android.os.Build
;
import
android.os.Bundle
;
import
android.os.Bundle
;
import
android.provider.MediaStore
;
import
android.support.v4.app.FragmentManager
;
import
android.support.v4.app.ActivityCompat
;
import
android.support.v4.app.FragmentTransaction
;
import
android.support.v4.content.ContextCompat
;
import
android.support.v4.widget.ImageViewCompat
;
import
android.support.v7.widget.Toolbar
;
import
android.support.v7.widget.Toolbar
;
import
android.util.Base64
;
import
android.util.Log
;
import
android.view.LayoutInflater
;
import
android.view.LayoutInflater
;
import
android.view.MotionEvent
;
import
android.view.View
;
import
android.view.View
;
import
android.view.ViewGroup
;
import
android.view.ViewGroup
;
import
android.widget.Button
;
import
android.webkit.CookieManager
;
import
android.widget.CheckBox
;
import
android.webkit.CookieSyncManager
;
import
android.widget.DatePicker
;
import
android.webkit.ValueCallback
;
import
android.widget.EditText
;
import
android.webkit.WebChromeClient
;
import
android.widget.ImageButton
;
import
android.webkit.WebSettings
;
import
android.widget.ImageView
;
import
android.webkit.WebView
;
import
android.widget.RelativeLayout
;
import
android.webkit.WebViewClient
;
import
android.widget.TextView
;
import
android.widget.TimePicker
;
import
android.widget.Toast
;
import
android.widget.Toast
;
import
com.
squareup.picasso.Picasso
;
import
com.
google.gson.Gson
;
import
java.io.ByteArrayOutputStream
;
import
java.sql.Timestamp
;
import
java.util.Arrays
;
import
java.util.Calendar
;
import
java.util.GregorianCalendar
;
import
butterknife.BindView
;
import
butterknife.ButterKnife
;
import
app.insti.Constants
;
import
app.insti.Constants
;
import
app.insti.MainActivity
;
import
app.insti.R
;
import
app.insti.R
;
import
app.insti.api.RetrofitInterface
;
import
app.insti.api.RetrofitInterface
;
import
app.insti.api.ServiceGenerator
;
import
app.insti.api.ServiceGenerator
;
import
app.insti.api.model.EventCreateRequest
;
import
app.insti.data.Event
;
import
app.insti.api.model.EventCreateResponse
;
import
app.insti.api.model.ImageUploadRequest
;
import
app.insti.api.model.ImageUploadResponse
;
import
retrofit2.Call
;
import
retrofit2.Call
;
import
retrofit2.Callback
;
import
retrofit2.Callback
;
import
retrofit2.Response
;
import
retrofit2.Response
;
import
static
android
.
app
.
Activity
.
RESULT_OK
;
import
static
app
.
insti
.
Constants
.
MY_PERMISSIONS_REQUEST_READ_EXTERNAL_STORAGE
;
import
static
app
.
insti
.
Constants
.
RESULT_LOAD_IMAGE
;
public
class
AddEventFragment
extends
BaseFragment
{
public
class
AddEventFragment
extends
BaseFragment
{
@BindView
(
R
.
id
.
button_createEvent
)
private
ProgressDialog
progressDialog
;
Button
createEvent
;
@BindView
(
R
.
id
.
tv_start
)
TextView
start
;
@BindView
(
R
.
id
.
et_eventName
)
EditText
eventName
;
@BindView
(
R
.
id
.
tv_end
)
TextView
end
;
@BindView
(
R
.
id
.
et_venue
)
EditText
venue
;
@BindView
(
R
.
id
.
et_eventDetails
)
EditText
details
;
@BindView
(
R
.
id
.
iv_eventImage
)
ImageView
eventImage
;
@BindView
(
R
.
id
.
ib_eventImage
)
ImageButton
imageButton
;
Timestamp
timestamp_start
;
Timestamp
timestamp_end
;
@BindView
(
R
.
id
.
advanced_menu
)
RelativeLayout
advancedMenu
;
@BindView
(
R
.
id
.
cb_public
)
CheckBox
cb_public
;
@BindView
(
R
.
id
.
cb_permission
)
CheckBox
cb_permission
;
@BindView
(
R
.
id
.
map_location
)
EditText
et_mapLocation
;
@BindView
(
R
.
id
.
open
)
ImageView
open
;
@BindView
(
R
.
id
.
close
)
ImageView
close
;
ImageView
eventPictureImageView
;
int
publicStatus
;
View
view
;
String
base64Image
;
ProgressDialog
progressDialog
;
String
TAG
=
"AddEventFragment"
;
public
ValueCallback
<
Uri
[]>
uploadMessage
;
public
AddEventFragment
()
{
public
AddEventFragment
()
{
// Required empty public constructor
// Required empty public constructor
}
}
public
static
String
convertImageToString
(
Bitmap
imageBitmap
)
{
@Override
ByteArrayOutputStream
stream
=
new
ByteArrayOutputStream
();
public
void
onStart
()
{
if
(
imageBitmap
!=
null
)
{
super
.
onStart
();
imageBitmap
.
compress
(
Bitmap
.
CompressFormat
.
JPEG
,
60
,
stream
);
byte
[]
byteArray
=
stream
.
toByteArray
();
return
Base64
.
encodeToString
(
byteArray
,
Base64
.
DEFAULT
);
}
else
{
return
null
;
}
}
public
static
Timestamp
makeTimestamp
(
int
year
,
int
month
,
int
day
,
int
hour
,
int
minute
)
{
Calendar
cal
=
new
GregorianCalendar
();
cal
.
set
(
Calendar
.
YEAR
,
year
);
cal
.
set
(
Calendar
.
MONTH
,
month
);
cal
.
set
(
Calendar
.
DATE
,
day
);
cal
.
set
(
Calendar
.
HOUR_OF_DAY
,
hour
);
cal
.
set
(
Calendar
.
MINUTE
,
minute
);
return
new
Timestamp
(
cal
.
getTimeInMillis
());
}
}
@Override
@Override
public
View
onCreateView
(
LayoutInflater
inflater
,
ViewGroup
container
,
public
View
onCreateView
(
LayoutInflater
inflater
,
ViewGroup
container
,
Bundle
savedInstanceState
)
{
Bundle
savedInstanceState
)
{
container
.
removeAllViews
();
container
.
removeAllViews
();
View
view
=
inflater
.
inflate
(
R
.
layout
.
fragment_add_event
,
container
,
false
);
view
=
inflater
.
inflate
(
R
.
layout
.
fragment_add_event
,
container
,
false
);
/* Show progress dialog */
ButterKnife
.
bind
(
this
,
view
);
Toolbar
toolbar
=
getActivity
().
findViewById
(
R
.
id
.
toolbar
);
toolbar
.
setTitle
(
"Add Event"
);
eventPictureImageView
=
view
.
findViewById
(
R
.
id
.
ib_eventImage
);
progressDialog
=
new
ProgressDialog
(
getContext
());
progressDialog
=
new
ProgressDialog
(
getContext
());
progressDialog
.
setMessage
(
"Loading"
);
progressDialog
.
setCancelable
(
false
);
progressDialog
.
show
();
cb_permission
.
setVisibility
(
View
.
GONE
);
String
host
=
"insti.app"
;
cb_public
.
setVisibility
(
View
.
GONE
);
Toolbar
toolbar
=
getActivity
().
findViewById
(
R
.
id
.
toolbar
);
et_mapLocation
.
setVisibility
(
View
.
GONE
);
toolbar
.
setTitle
(
getArguments
().
containsKey
(
"id"
)
?
"Update Event"
:
"Add Event"
);
if
(
savedInstanceState
==
null
)
{
close
.
setVisibility
(
View
.
GONE
);
WebView
webView
=
view
.
findViewById
(
R
.
id
.
add_event_webview
);
open
.
setVisibility
(
View
.
VISIBLE
);
webView
.
getSettings
().
setBuiltInZoomControls
(
true
);
webView
.
getSettings
().
setDisplayZoomControls
(
false
);
webView
.
getSettings
().
setAllowFileAccess
(
true
);
start
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
WebSettings
webSettings
=
webView
.
getSettings
();
@Override
webSettings
.
setJavaScriptEnabled
(
true
);
public
void
onClick
(
View
v
)
{
webSettings
.
setDomStorageEnabled
(
true
);
webView
.
getSettings
().
setCacheMode
(
WebSettings
.
LOAD_CACHE_ELSE_NETWORK
);
webView
.
setWebChromeClient
(
new
MyWebChromeClient
());
webView
.
setWebViewClient
(
new
MyWebViewClient
());
CookieManager
cookieManager
=
CookieManager
.
getInstance
();
String
cookieString
=
((
MainActivity
)
getActivity
()).
getSessionIDHeader
();
cookieManager
.
setCookie
(
host
,
cookieString
);
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
LOLLIPOP_MR1
)
{
CookieManager
.
getInstance
().
flush
();
}
else
{
CookieSyncManager
.
getInstance
().
sync
();
}
final
Calendar
calendar
=
Calendar
.
getInstance
();
String
url
=
"https://"
+
host
+
"/add-event?sandbox=true"
;
int
mYear
=
calendar
.
get
(
Calendar
.
YEAR
);
if
(
getArguments
().
containsKey
(
"id"
))
{
int
mMonth
=
calendar
.
get
(
Calendar
.
MONTH
);
url
=
"https://"
+
host
+
"/edit-event/"
+
getArguments
().
getString
(
"id"
)
+
"?sandbox=true"
;
int
mDay
=
calendar
.
get
(
Calendar
.
DAY_OF_MONTH
);
}
webView
.
loadUrl
(
url
);
final
int
mHour
=
calendar
.
get
(
Calendar
.
HOUR_OF_DAY
);
webView
.
setOnTouchListener
(
new
View
.
OnTouchListener
()
{
final
int
mMin
=
calendar
.
get
(
Calendar
.
MINUTE
);
float
m_downX
;
public
boolean
onTouch
(
View
v
,
MotionEvent
event
)
{
if
(
event
.
getPointerCount
()
>
1
)
{
//Multi touch detected
return
true
;
}
DatePickerDialog
datePickerDialog
=
new
DatePickerDialog
(
getContext
(),
new
DatePickerDialog
.
OnDateSetListener
()
{
switch
(
event
.
getAction
())
{
case
MotionEvent
.
ACTION_DOWN
:
{
// save the x
m_downX
=
event
.
getX
();
break
;
}
case
MotionEvent
.
ACTION_MOVE
:
case
MotionEvent
.
ACTION_CANCEL
:
case
MotionEvent
.
ACTION_UP
:
{
// set x so that it doesn't move
event
.
setLocation
(
m_downX
,
event
.
getY
());
break
;
}
@Override
public
void
onDateSet
(
DatePicker
view
,
final
int
year
,
final
int
month
,
final
int
dayOfMonth
)
{
TimePickerDialog
timePickerDialog
=
new
TimePickerDialog
(
getContext
(),
new
TimePickerDialog
.
OnTimeSetListener
()
{
@Override
public
void
onTimeSet
(
TimePicker
view
,
int
hourOfDay
,
int
minute
)
{
timestamp_start
=
makeTimestamp
(
year
,
month
,
dayOfMonth
,
hourOfDay
,
minute
);
if
(
timestamp_start
.
after
(
new
Timestamp
(
Calendar
.
getInstance
().
getTimeInMillis
())))
{
if
(
timestamp_end
==
null
||
timestamp_end
.
after
(
timestamp_start
))
{
start
.
setText
(
dayOfMonth
+
"/"
+
month
+
"/"
+
year
+
" "
+
hourOfDay
+
":"
+
minute
);
enableEndDatePicker
(
year
,
month
,
dayOfMonth
,
hourOfDay
,
minute
);
}
}
else
{
Toast
.
makeText
(
getContext
(),
"Start Time cannot be in the past"
,
Toast
.
LENGTH_SHORT
).
show
();
}
}
},
mHour
,
mMin
,
true
);
timePickerDialog
.
show
();
}
}
},
mYear
,
mMonth
,
mDay
);
return
false
;
datePickerDialog
.
show
();
}
});
if
(
cb_permission
.
isChecked
())
{
publicStatus
=
1
;
}
else
publicStatus
=
0
;
advancedMenu
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
public
void
onClick
(
View
v
)
{
if
(
cb_public
.
getVisibility
()
==
View
.
VISIBLE
)
{
open
.
setVisibility
(
View
.
VISIBLE
);
close
.
setVisibility
(
View
.
GONE
);
cb_permission
.
setVisibility
(
View
.
GONE
);
cb_public
.
setVisibility
(
View
.
GONE
);
et_mapLocation
.
setVisibility
(
View
.
GONE
);
}
else
{
close
.
setVisibility
(
View
.
VISIBLE
);
open
.
setVisibility
(
View
.
GONE
);
cb_permission
.
setVisibility
(
View
.
VISIBLE
);
cb_public
.
setVisibility
(
View
.
VISIBLE
);
et_mapLocation
.
setVisibility
(
View
.
VISIBLE
);
}
}
});
imageButton
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
public
void
onClick
(
View
v
)
{
if
(
ContextCompat
.
checkSelfPermission
(
getContext
(),
Manifest
.
permission
.
READ_EXTERNAL_STORAGE
)
!=
PackageManager
.
PERMISSION_GRANTED
)
{
// Permission is not granted
ActivityCompat
.
requestPermissions
(
getActivity
(),
new
String
[]{
Manifest
.
permission
.
READ_EXTERNAL_STORAGE
},
MY_PERMISSIONS_REQUEST_READ_EXTERNAL_STORAGE
);
return
;
}
}
Intent
i
=
new
Intent
(
Intent
.
ACTION_PICK
,
android
.
provider
.
MediaStore
.
Images
.
Media
.
EXTERNAL_CONTENT_URI
);
});
startActivityForResult
(
i
,
RESULT_LOAD_IMAGE
);
}
}
});
createEvent
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
public
void
onClick
(
View
v
)
{
progressDialog
.
setIndeterminate
(
true
);
progressDialog
.
setCancelable
(
false
);
progressDialog
.
show
();
sendImage
();
}
});
return
view
;
return
view
;
}
}
p
rivate
void
enableEndDatePicker
(
final
int
startYear
,
final
int
startMonth
,
final
int
startDayOfMonth
,
final
int
startHourOfDay
,
final
int
startMinute
)
{
p
ublic
class
MyWebViewClient
extends
WebViewClient
{
end
.
setEnabled
(
true
);
@Override
end
.
setOnClickListener
(
new
View
.
OnClickListener
(
)
{
public
boolean
shouldOverrideUrlLoading
(
WebView
view
,
String
url
)
{
@Override
/* Check URL */
public
void
onClick
(
View
v
)
{
if
(
url
.
contains
(
"/event/"
)
)
{
DatePickerDialog
datePickerDialog
=
new
DatePickerDialog
(
getContext
(),
new
DatePickerDialog
.
OnDateSetListener
()
{
url
=
url
.
substring
(
url
.
lastIndexOf
(
"/"
)
+
1
);
RetrofitInterface
retrofitInterface
=
ServiceGenerator
.
createService
(
RetrofitInterface
.
class
);
retrofitInterface
.
getEvent
(((
MainActivity
)
getActivity
()).
getSessionIDHeader
(),
url
).
enqueue
(
new
Callback
<
Event
>()
{
@Override
@Override
public
void
onDateSet
(
DatePicker
view
,
final
int
year
,
final
int
month
,
final
int
dayOfMonth
)
{
public
void
onResponse
(
Call
<
Event
>
call
,
Response
<
Event
>
response
)
{
TimePickerDialog
timePickerDialog
=
new
TimePickerDialog
(
getContext
(),
new
TimePickerDialog
.
OnTimeSetListener
()
{
if
(
response
.
isSuccessful
())
{
@Override
openEvent
(
response
.
body
());
public
void
onTimeSet
(
TimePicker
view
,
int
hourOfDay
,
int
minute
)
{
}
timestamp_end
=
makeTimestamp
(
year
,
month
,
dayOfMonth
,
hourOfDay
,
minute
);
if
(
timestamp_end
.
after
(
timestamp_start
))
end
.
setText
(
dayOfMonth
+
"/"
+
month
+
"/"
+
year
+
" "
+
hourOfDay
+
":"
+
minute
);
else
{
Toast
.
makeText
(
getContext
(),
"End Time cannot be before Start Time"
,
Toast
.
LENGTH_SHORT
).
show
();
}
}
},
startHourOfDay
,
startMinute
,
true
);
timePickerDialog
.
show
();
}
}
},
startYear
,
startMonth
,
startDayOfMonth
);
datePickerDialog
.
show
();
}
});
}
private
void
sendImage
()
{
@Override
progressDialog
.
setMessage
(
"Uploading Image"
);
public
void
onFailure
(
Call
<
Event
>
call
,
Throwable
t
)
{
}
ImageUploadRequest
imageUploadRequest
=
new
ImageUploadRequest
(
base64Image
);
});
RetrofitInterface
retrofitInterface
=
ServiceGenerator
.
createService
(
RetrofitInterface
.
class
);
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
())
{
ImageUploadResponse
imageUploadResponse
=
response
.
body
();
String
imageURL
=
imageUploadResponse
.
getPictureURL
();
addEvent
(
imageURL
);
}
}
@Override
return
true
;
public
void
onFailure
(
Call
<
ImageUploadResponse
>
call
,
Throwable
t
)
{
progressDialog
.
dismiss
();
}
}
});
// return true; //Indicates WebView to NOT load the url;
return
false
;
//Allow WebView to load url
}
}
}
public
void
addEvent
(
String
eventImageURL
)
{
public
class
MyWebChromeClient
extends
WebChromeClient
{
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
(
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
();
progressDialog
.
dismiss
();
}
@Override
@Override
public
void
onFailure
(
Call
<
EventCreateResponse
>
call
,
Throwable
t
)
{
public
void
onProgressChanged
(
WebView
view
,
int
progress
)
{
Toast
.
makeText
(
getContext
(),
"Event Creation Failed"
,
Toast
.
LENGTH_SHORT
).
show
();
if
(
progress
<
100
)
{
progressDialog
.
show
();
}
if
(
progress
==
100
)
{
progressDialog
.
dismiss
();
progressDialog
.
dismiss
();
}
}
});
}
@Override
public
void
onActivityResult
(
int
requestCode
,
int
resultCode
,
Intent
data
)
{
super
.
onActivityResult
(
requestCode
,
resultCode
,
data
);
if
(
requestCode
==
RESULT_LOAD_IMAGE
&&
resultCode
==
RESULT_OK
&&
null
!=
data
)
{
Uri
selectedImage
=
data
.
getData
();
String
[]
filePathColumn
=
{
MediaStore
.
Images
.
Media
.
DATA
};
Cursor
cursor
=
getActivity
().
getContentResolver
().
query
(
selectedImage
,
filePathColumn
,
null
,
null
,
null
);
cursor
.
moveToFirst
();
int
columnIndex
=
cursor
.
getColumnIndex
(
filePathColumn
[
0
]);
String
picturePath
=
cursor
.
getString
(
columnIndex
);
cursor
.
close
();
ImageViewCompat
.
setImageTintList
(
eventPictureImageView
,
null
);
Picasso
.
get
().
load
(
selectedImage
).
into
(
eventPictureImageView
);
base64Image
=
convertImageToString
(
getScaledBitmap
(
picturePath
,
800
,
800
));
Log
.
d
(
TAG
,
"onActivityResult: "
+
base64Image
);
}
}
}
private
Bitmap
getScaledBitmap
(
String
picturePath
,
int
width
,
int
height
)
{
@Override
BitmapFactory
.
Options
sizeOptions
=
new
BitmapFactory
.
Options
();
public
boolean
onShowFileChooser
(
WebView
webView
,
ValueCallback
<
Uri
[]>
filePathCallback
,
FileChooserParams
fileChooserParams
)
{
sizeOptions
.
inJustDecodeBounds
=
true
;
// make sure there is no existing message
BitmapFactory
.
decodeFile
(
picturePath
,
sizeOptions
);
if
(
uploadMessage
!=
null
)
{
uploadMessage
.
onReceiveValue
(
null
);
uploadMessage
=
null
;
}
int
inSampleSize
=
calculateInSampleSize
(
sizeOptions
,
width
,
height
)
;
uploadMessage
=
filePathCallback
;
sizeOptions
.
inJustDecodeBounds
=
false
;
Intent
intent
=
fileChooserParams
.
createIntent
();
sizeOptions
.
inSampleSize
=
inSampleSize
;
try
{
startActivityForResult
(
intent
,
101
);
}
catch
(
ActivityNotFoundException
e
)
{
uploadMessage
=
null
;
Toast
.
makeText
(
getContext
(),
"Cannot open file chooser"
,
Toast
.
LENGTH_LONG
).
show
();
return
false
;
}
return
BitmapFactory
.
decodeFile
(
picturePath
,
sizeOptions
);
return
true
;
}
}
}
private
int
calculateInSampleSize
(
BitmapFactory
.
Options
options
,
int
reqWidth
,
int
reqHeight
)
{
void
openEvent
(
Event
event
)
{
// Raw height and width of image
String
eventJson
=
new
Gson
().
toJson
(
event
);
final
int
height
=
options
.
outHeight
;
Bundle
bundle
=
getArguments
();
final
int
width
=
options
.
outWidth
;
if
(
bundle
==
null
)
int
inSampleSize
=
1
;
bundle
=
new
Bundle
();
bundle
.
putString
(
Constants
.
EVENT_JSON
,
eventJson
);
if
(
height
>
reqHeight
||
width
>
reqWidth
)
{
EventFragment
eventFragment
=
new
EventFragment
();
eventFragment
.
setArguments
(
bundle
);
// Calculate ratios of height and width to requested height and
FragmentManager
manager
=
getActivity
().
getSupportFragmentManager
();
// width
FragmentTransaction
transaction
=
manager
.
beginTransaction
();
final
int
heightRatio
=
Math
.
round
((
float
)
height
/
(
float
)
reqHeight
);
transaction
.
setCustomAnimations
(
R
.
anim
.
slide_in_left
,
R
.
anim
.
slide_out_left
,
R
.
anim
.
slide_in_right
,
R
.
anim
.
slide_out_right
);
final
int
widthRatio
=
Math
.
round
((
float
)
width
/
(
float
)
reqWidth
);
transaction
.
replace
(
R
.
id
.
framelayout_for_fragment
,
eventFragment
,
eventFragment
.
getTag
());
transaction
.
addToBackStack
(
eventFragment
.
getTag
()).
commit
();
}
// Choose the smallest ratio as inSampleSize value, this will
public
void
onActivityResult
(
int
requestCode
,
int
resultCode
,
Intent
data
){
// guarantee
if
(
requestCode
==
101
)
{
// a final image with both dimensions larger than or equal to the
if
(
uploadMessage
==
null
)
return
;
// requested height and width.
uploadMessage
.
onReceiveValue
(
WebChromeClient
.
FileChooserParams
.
parseResult
(
resultCode
,
data
));
inSampleSize
=
heightRatio
<
widthRatio
?
heightRatio
:
widthRatio
;
uploadMessage
=
null
;
}
}
return
inSampleSize
;
}
}
}
}
app/src/main/java/app/insti/fragment/CalendarFragment.java
View file @
1c32c302
...
@@ -93,8 +93,7 @@ public class CalendarFragment extends BaseFragment {
...
@@ -93,8 +93,7 @@ public class CalendarFragment extends BaseFragment {
}
}
});
});
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);
}
}
updateEvents
();
updateEvents
();
...
...
app/src/main/java/app/insti/fragment/EventFragment.java
View file @
1c32c302
...
@@ -12,8 +12,10 @@ import android.graphics.Rect;
...
@@ -12,8 +12,10 @@ import android.graphics.Rect;
import
android.net.Uri
;
import
android.net.Uri
;
import
android.os.AsyncTask
;
import
android.os.AsyncTask
;
import
android.os.Bundle
;
import
android.os.Bundle
;
import
android.support.design.widget.FloatingActionButton
;
import
android.support.v4.app.Fragment
;
import
android.support.v4.app.Fragment
;
import
android.support.v4.app.FragmentTransaction
;
import
android.support.v4.app.FragmentTransaction
;
import
android.support.v4.widget.NestedScrollView
;
import
android.support.v7.widget.LinearLayoutManager
;
import
android.support.v7.widget.LinearLayoutManager
;
import
android.support.v7.widget.RecyclerView
;
import
android.support.v7.widget.RecyclerView
;
import
android.support.v7.widget.Toolbar
;
import
android.support.v7.widget.Toolbar
;
...
@@ -228,6 +230,31 @@ public class EventFragment extends BackHandledFragment {
...
@@ -228,6 +230,31 @@ public class EventFragment extends BackHandledFragment {
}
}
});
});
mShortAnimationDuration
=
getResources
().
getInteger
(
android
.
R
.
integer
.
config_shortAnimTime
);
mShortAnimationDuration
=
getResources
().
getInteger
(
android
.
R
.
integer
.
config_shortAnimTime
);
final
FloatingActionButton
fab
=
(
FloatingActionButton
)
getView
().
findViewById
(
R
.
id
.
edit_fab
);
if
(((
MainActivity
)
getActivity
()).
editEventAccess
(
event
))
{
fab
.
setVisibility
(
View
.
VISIBLE
);
NestedScrollView
nsv
=
(
NestedScrollView
)
getView
().
findViewById
(
R
.
id
.
event_scrollview
);
nsv
.
setOnScrollChangeListener
(
new
NestedScrollView
.
OnScrollChangeListener
()
{
@Override
public
void
onScrollChange
(
NestedScrollView
v
,
int
scrollX
,
int
scrollY
,
int
oldScrollX
,
int
oldScrollY
)
{
if
(
scrollY
>
oldScrollY
)
fab
.
hide
();
else
fab
.
show
();
}
});
}
fab
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
public
void
onClick
(
View
v
)
{
AddEventFragment
addEventFragment
=
new
AddEventFragment
();
Bundle
bundle
=
new
Bundle
();
bundle
.
putString
(
"id"
,
event
.
getEventID
());
addEventFragment
.
setArguments
(
bundle
);
((
MainActivity
)
getActivity
()).
updateFragment
(
addEventFragment
);
}
});
}
}
void
setFollowButtonColors
(
int
status
)
{
void
setFollowButtonColors
(
int
status
)
{
...
...
app/src/main/java/app/insti/fragment/FeedFragment.java
View file @
1c32c302
...
@@ -61,8 +61,6 @@ public class FeedFragment extends BaseFragment {
...
@@ -61,8 +61,6 @@ public class FeedFragment extends BaseFragment {
Toolbar
toolbar
=
getActivity
().
findViewById
(
R
.
id
.
toolbar
);
Toolbar
toolbar
=
getActivity
().
findViewById
(
R
.
id
.
toolbar
);
toolbar
.
setTitle
(
"Feed"
);
toolbar
.
setTitle
(
"Feed"
);
fab
=
(
FloatingActionButton
)
view
.
findViewById
(
R
.
id
.
fab
);
feedSwipeRefreshLayout
=
view
.
findViewById
(
R
.
id
.
feed_swipe_refresh_layout
);
feedSwipeRefreshLayout
=
view
.
findViewById
(
R
.
id
.
feed_swipe_refresh_layout
);
feedSwipeRefreshLayout
.
setOnRefreshListener
(
new
SwipeRefreshLayout
.
OnRefreshListener
()
{
feedSwipeRefreshLayout
.
setOnRefreshListener
(
new
SwipeRefreshLayout
.
OnRefreshListener
()
{
@Override
@Override
...
@@ -71,33 +69,18 @@ public class FeedFragment extends BaseFragment {
...
@@ -71,33 +69,18 @@ public class FeedFragment extends BaseFragment {
}
}
});
});
fab
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
public
void
onClick
(
View
v
)
{
AddEventFragment
addEventFragment
=
new
AddEventFragment
();
addEventFragment
.
setArguments
(
getArguments
());
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
.
replace
(
R
.
id
.
relative_layout
,
addEventFragment
);
ft
.
addToBackStack
(
"addEvent"
);
ft
.
commit
();
}
});
return
view
;
return
view
;
}
}
@Override
@Override
public
void
onStart
()
{
public
void
onStart
()
{
super
.
onStart
();
super
.
onStart
();
if
(((
MainActivity
)
getActivity
()).
createEventAccess
())
{
/* TODO: Uncomment the following line when Add Event is completed */
// fab.setVisibility(View.VISIBLE);
}
appDatabase
=
AppDatabase
.
getAppDatabase
(
getContext
());
appDatabase
=
AppDatabase
.
getAppDatabase
(
getContext
());
new
showEventsFromDB
().
execute
();
new
showEventsFromDB
().
execute
();
fab
=
(
FloatingActionButton
)
getView
().
findViewById
(
R
.
id
.
fab
);
feedRecyclerView
=
getView
().
findViewById
(
R
.
id
.
feed_recycler_view
);
updateFeed
();
updateFeed
();
}
}
...
@@ -130,6 +113,26 @@ public class FeedFragment extends BaseFragment {
...
@@ -130,6 +113,26 @@ public class FeedFragment extends BaseFragment {
/* Skip if we're already destroyed */
/* Skip if we're already destroyed */
if
(
getActivity
()
==
null
||
getView
()
==
null
)
return
;
if
(
getActivity
()
==
null
||
getView
()
==
null
)
return
;
if
(((
MainActivity
)
getActivity
()).
createEventAccess
())
{
fab
.
setVisibility
(
View
.
VISIBLE
);
fab
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
public
void
onClick
(
View
v
)
{
AddEventFragment
addEventFragment
=
new
AddEventFragment
();
Bundle
bundle
=
new
Bundle
();
addEventFragment
.
setArguments
(
bundle
);
((
MainActivity
)
getActivity
()).
updateFragment
(
addEventFragment
);
}
});
feedRecyclerView
.
addOnScrollListener
(
new
RecyclerView
.
OnScrollListener
(){
@Override
public
void
onScrolled
(
RecyclerView
recyclerView
,
int
dx
,
int
dy
){
if
(
dy
>
0
)
fab
.
hide
();
else
if
(
dy
<
0
)
fab
.
show
();
}
});
}
/* Make first event image big */
/* Make first event image big */
if
(
events
.
size
()
>
1
)
{
if
(
events
.
size
()
>
1
)
{
events
.
get
(
0
).
setEventBigImage
(
true
);
events
.
get
(
0
).
setEventBigImage
(
true
);
...
@@ -156,9 +159,9 @@ public class FeedFragment extends BaseFragment {
...
@@ -156,9 +159,9 @@ public class FeedFragment extends BaseFragment {
@Override
@Override
public
void
run
(
Activity
pActivity
)
{
public
void
run
(
Activity
pActivity
)
{
try
{
try
{
feedRecyclerView
=
getActivity
().
findViewById
(
R
.
id
.
feed_recycler_view
);
feedRecyclerView
.
setAdapter
(
feedAdapter
);
feedRecyclerView
.
setAdapter
(
feedAdapter
);
feedRecyclerView
.
setLayoutManager
(
new
LinearLayoutManager
(
getContext
()));
feedRecyclerView
.
setLayoutManager
(
new
LinearLayoutManager
(
getContext
()));
}
catch
(
NullPointerException
e
)
{
}
catch
(
NullPointerException
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();
}
}
...
...
app/src/main/java/app/insti/fragment/MyEventsFragment.java
View file @
1c32c302
...
@@ -58,11 +58,7 @@ public class MyEventsFragment extends BaseFragment {
...
@@ -58,11 +58,7 @@ public class MyEventsFragment 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
());
((
MainActivity
)
getActivity
()).
updateFragment
(
addEventFragment
);
FragmentTransaction
ft
=
getChildFragmentManager
().
beginTransaction
();
ft
.
replace
(
R
.
id
.
relative_layout
,
addEventFragment
);
ft
.
addToBackStack
(
"addEvent"
);
ft
.
commit
();
}
}
});
});
return
view
;
return
view
;
...
@@ -73,8 +69,7 @@ public class MyEventsFragment extends BaseFragment {
...
@@ -73,8 +69,7 @@ public class MyEventsFragment extends BaseFragment {
super
.
onStart
();
super
.
onStart
();
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
());
...
...
app/src/main/res/drawable/ic_add_black_24dp.xml
0 → 100644
View file @
1c32c302
<vector
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:width=
"24dp"
android:height=
"24dp"
android:viewportWidth=
"24.0"
android:viewportHeight=
"24.0"
>
<path
android:fillColor=
"#FF000000"
android:pathData=
"M19,13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"
/>
</vector>
app/src/main/res/drawable/ic_edit_black_24dp.xml
0 → 100644
View file @
1c32c302
<vector
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:width=
"24dp"
android:height=
"24dp"
android:viewportWidth=
"24.0"
android:viewportHeight=
"24.0"
>
<path
android:fillColor=
"#FF000000"
android:pathData=
"M3,17.25V21h3.75L17.81,9.94l-3.75,-3.75L3,17.25zM20.71,7.04c0.39,-0.39 0.39,-1.02 0,-1.41l-2.34,-2.34c-0.39,-0.39 -1.02,-0.39 -1.41,0l-1.83,1.83 3.75,3.75 1.83,-1.83z"
/>
</vector>
app/src/main/res/layout/fragment_add_event.xml
View file @
1c32c302
...
@@ -5,183 +5,12 @@
...
@@ -5,183 +5,12 @@
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
"
>
android:
scrollbars=
"none
"
>
<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
app/src/main/res/layout/fragment_calendar.xml
View file @
1c32c302
...
@@ -70,7 +70,7 @@
...
@@ -70,7 +70,7 @@
android:layout_alignParentBottom=
"true"
android:layout_alignParentBottom=
"true"
android:layout_alignParentRight=
"true"
android:layout_alignParentRight=
"true"
android:layout_margin=
"16dp"
android:layout_margin=
"16dp"
android:src=
"@
android:drawable/ic_input_add
"
android:src=
"@
drawable/ic_add_black_24dp
"
android:tint=
"@android:color/black"
android:tint=
"@android:color/black"
android:visibility=
"gone"
/>
android:visibility=
"gone"
/>
...
...
app/src/main/res/layout/fragment_event.xml
View file @
1c32c302
...
@@ -6,212 +6,230 @@
...
@@ -6,212 +6,230 @@
android:layout_height=
"match_parent"
android:layout_height=
"match_parent"
tools:context=
"app.insti.fragment.EventFragment"
>
tools:context=
"app.insti.fragment.EventFragment"
>
<
Linear
Layout
<
Relative
Layout
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:layout_height=
"match_parent"
>
android:orientation=
"vertical"
>
<
ScrollView
<
LinearLayout
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
>
android:layout_height=
"match_parent"
android:orientation=
"vertical"
>
<LinearLayout
<android.support.v4.widget.NestedScrollView
android:id=
"@+id/event_scrollview"
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"0dp"
android:layout_height=
"wrap_content"
>
android:layout_weight=
"1"
android:orientation=
"vertical"
>
<ImageView
<LinearLayout
android:id=
"@+id/event_picture_2"
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"
30
0dp"
android:layout_height=
"0dp"
android:
adjustViewBounds=
"true
"
android:
layout_weight=
"1
"
android:
scaleType=
"centerCrop"
/
>
android:
orientation=
"vertical"
>
<android.support.v7.widget.CardView
<ImageView
android:layout_width=
"match_parent"
android:id=
"@+id/event_picture_2"
android:layout_height=
"wrap_content"
android:layout_width=
"match_parent"
app:cardBackgroundColor=
"@color/colorPrimary"
>
android:layout_height=
"300dp"
android:adjustViewBounds=
"true"
android:scaleType=
"centerCrop"
/>
<
LinearLayout
<
android.support.v7.widget.CardView
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center_vertical"
app:cardBackgroundColor=
"@color/colorPrimary"
>
android:layout_marginBottom=
"12dp"
android:layout_marginEnd=
"16dp"
android:layout_marginStart=
"16dp"
android:layout_marginTop=
"12dp"
android:layout_weight=
"3"
android:orientation=
"vertical"
>
<LinearLayout
<LinearLayout
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:orientation=
"horizontal"
>
android:layout_gravity=
"center_vertical"
android:layout_marginBottom=
"12dp"
<TextView
android:layout_marginEnd=
"16dp"
android:id=
"@+id/event_page_title"
android:layout_marginStart=
"16dp"
android:layout_width=
"0dp"
android:layout_marginTop=
"12dp"
android:layout_weight=
"3"
android:orientation=
"vertical"
>
<LinearLayout
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_weight=
"10"
android:orientation=
"horizontal"
>
android:text=
"Event Title"
android:textColor=
"#fff"
<TextView
android:textSize=
"21sp"
android:id=
"@+id/event_page_title"
android:textStyle=
"bold"
/>
android:layout_width=
"0dp"
android:layout_height=
"wrap_content"
<ImageButton
android:layout_weight=
"10"
android:id=
"@+id/web_event_button"
android:text=
"Event Title"
android:textColor=
"#fff"
android:textSize=
"21sp"
android:textStyle=
"bold"
/>
<ImageButton
android:id=
"@+id/web_event_button"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center_vertical"
android:layout_marginStart=
"8dp"
android:background=
"?attr/selectableItemBackgroundBorderless"
android:contentDescription=
"Event Website"
android:tint=
"@color/colorWhite"
android:visibility=
"invisible"
app:srcCompat=
"@drawable/ic_language_black_24dp"
/>
<ImageButton
android:id=
"@+id/navigate_button"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center_vertical"
android:layout_marginStart=
"8dp"
android:background=
"?attr/selectableItemBackgroundBorderless"
android:contentDescription=
"Navigate"
android:tint=
"@color/colorWhite"
app:srcCompat=
"@drawable/baseline_navigation_24"
/>
<ImageButton
android:id=
"@+id/share_event_button"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center_vertical"
android:layout_marginStart=
"8dp"
android:background=
"?attr/selectableItemBackgroundBorderless"
android:contentDescription=
"Share Event"
android:src=
"@drawable/ic_menu_share"
android:tint=
"@color/colorWhite"
/>
</LinearLayout>
<LinearLayout
android:layout_width=
"wrap_content"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center_vertical"
android:orientation=
"horizontal"
>
android:layout_marginStart=
"8dp"
android:background=
"?attr/selectableItemBackgroundBorderless"
<TextView
android:contentDescription=
"Event Website"
android:id=
"@+id/event_page_date"
android:tint=
"@color/colorWhite"
android:layout_width=
"wrap_content"
android:visibility=
"invisible"
android:layout_height=
"wrap_content"
app:srcCompat=
"@drawable/ic_language_black_24dp"
/>
android:text=
"No Date Specified"
android:textColor=
"#fff"
<ImageButton
android:textSize=
"16sp"
/>
android:id=
"@+id/navigate_button"
android:layout_width=
"wrap_content"
<TextView
android:layout_height=
"wrap_content"
android:layout_width=
"wrap_content"
android:layout_gravity=
"center_vertical"
android:layout_height=
"wrap_content"
android:layout_marginStart=
"8dp"
android:text=
" | "
android:background=
"?attr/selectableItemBackgroundBorderless"
android:textColor=
"#fff"
android:contentDescription=
"Navigate"
android:textSize=
"20sp"
/>
android:tint=
"@color/colorWhite"
app:srcCompat=
"@drawable/baseline_navigation_24"
/>
<TextView
android:id=
"@+id/event_page_time"
<ImageButton
android:layout_width=
"wrap_content"
android:id=
"@+id/share_event_button"
android:layout_height=
"wrap_content"
android:layout_width=
"wrap_content"
android:text=
"No Time Specified"
android:layout_height=
"wrap_content"
android:textColor=
"#fff"
android:layout_gravity=
"center_vertical"
android:textSize=
"16sp"
/>
android:layout_marginStart=
"8dp"
android:background=
"?attr/selectableItemBackgroundBorderless"
<TextView
android:contentDescription=
"Share Event"
android:layout_width=
"wrap_content"
android:src=
"@drawable/ic_menu_share"
android:layout_height=
"wrap_content"
android:tint=
"@color/colorWhite"
/>
android:text=
" | "
</LinearLayout>
android:textColor=
"#fff"
android:textSize=
"20sp"
/>
<TextView
android:id=
"@+id/event_page_venue"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:ellipsize=
"end"
android:text=
"No Venue Specified"
android:textColor=
"#fff"
android:textSize=
"16sp"
/>
</LinearLayout>
<LinearLayout
</LinearLayout>
android:layout_width=
"wrap_content"
</android.support.v7.widget.CardView>
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:text=
"No Date Specified"
android:textColor=
"#fff"
android:textSize=
"16sp"
/>
<TextView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
" | "
android:textColor=
"#fff"
android:textSize=
"20sp"
/>
<TextView
android:id=
"@+id/event_page_time"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"No Time Specified"
android:textColor=
"#fff"
android:textSize=
"16sp"
/>
<TextView
<LinearLayout
android:layout_width=
"wrap_content"
style=
"?android:attr/buttonBarStyle"
android:layout_height=
"wrap_content"
android:layout_width=
"match_parent"
android:text=
" | "
android:layout_height=
"wrap_content"
android:textColor=
"#fff"
android:orientation=
"horizontal"
>
android:textSize=
"20sp"
/>
<TextView
<Button
android:id=
"@+id/event_page_venue"
android:id=
"@+id/going_button"
android:layout_width=
"wrap_content"
style=
"?android:attr/buttonBarButtonStyle"
android:layout_height=
"wrap_content"
android:textAllCaps=
"false"
android:ellipsize=
"end"
android:layout_width=
"0dp"
android:text=
"No Venue Specified"
android:layout_height=
"wrap_content"
android:textColor=
"#fff"
android:layout_margin=
"0dp"
android:textSize=
"16sp"
/>
android:layout_weight=
"1"
</LinearLayout>
android:text=
"GOING"
android:textColor=
"@color/secondaryTextColor"
android:foreground=
"?attr/selectableItemBackground"
android:clickable=
"true"
/>
<View
android:layout_width=
"1dp"
android:layout_height=
"match_parent"
android:background=
"#aaa"
>
</View>
<Button
android:id=
"@+id/interested_button"
style=
"?android:attr/buttonBarButtonStyle"
android:textAllCaps=
"false"
android:layout_width=
"0dp"
android:layout_height=
"wrap_content"
android:layout_margin=
"0dp"
android:layout_weight=
"1"
android:text=
"INTERESTED"
android:textColor=
"@color/secondaryTextColor"
android:foreground=
"?attr/selectableItemBackground"
android:clickable=
"true"
/>
</LinearLayout>
</LinearLayout>
</android.support.v7.widget.CardView>
<LinearLayout
style=
"?android:attr/buttonBarStyle"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:orientation=
"horizontal"
>
<Button
android:id=
"@+id/going_button"
style=
"?android:attr/buttonBarButtonStyle"
android:textAllCaps=
"false"
android:layout_width=
"0dp"
android:layout_height=
"wrap_content"
android:layout_margin=
"0dp"
android:layout_weight=
"1"
android:text=
"GOING"
android:textColor=
"@color/secondaryTextColor"
android:foreground=
"?attr/selectableItemBackground"
android:clickable=
"true"
/>
<View
<View
android:layout_width=
"
1dp
"
android:layout_width=
"
match_parent
"
android:layout_height=
"
match_parent
"
android:layout_height=
"
1dp
"
android:background=
"#aaa"
>
android:background=
"#aaa"
>
</View>
</View>
<Button
<TextView
android:id=
"@+id/interested_button"
android:id=
"@+id/event_page_description"
style=
"?android:attr/buttonBarButtonStyle"
android:layout_width=
"match_parent"
android:textAllCaps=
"false"
android:layout_width=
"0dp"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_margin=
"0dp"
android:layout_marginBottom=
"16dp"
android:layout_weight=
"1"
android:layout_marginEnd=
"10dp"
android:text=
"INTERESTED"
android:layout_marginStart=
"10dp"
android:textColor=
"@color/secondaryTextColor"
android:layout_marginTop=
"12dp"
android:foreground=
"?attr/selectableItemBackground"
android:textColor=
"#333"
android:clickable=
"true"
/>
android:textSize=
"16sp"
/>
</LinearLayout>
<View
<android.support.v7.widget.RecyclerView
android:layout_width=
"match_parent"
android:id=
"@+id/body_card_recycler_view"
android:layout_height=
"1dp"
android:layout_width=
"match_parent"
android:background=
"#aaa"
>
android:layout_height=
"wrap_content"
android:layout_marginTop=
"10dp"
/>
</View>
</LinearLayout>
</android.support.v4.widget.NestedScrollView>
<TextView
</LinearLayout>
android:id=
"@+id/event_page_description"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_marginBottom=
"16dp"
android:layout_marginEnd=
"10dp"
android:layout_marginStart=
"10dp"
android:layout_marginTop=
"12dp"
android:textColor=
"#333"
android:textSize=
"16sp"
/>
<android.support.v7.widget.RecyclerView
android:id=
"@+id/body_card_recycler_view"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"10dp"
/>
</LinearLayout>
<android.support.design.widget.FloatingActionButton
</ScrollView>
android:id=
"@+id/edit_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=
"@drawable/ic_edit_black_24dp"
android:tint=
"@android:color/black"
android:visibility=
"gone"
/>
</
Linear
Layout>
</
Relative
Layout>
<app.insti.TouchImageView
<app.insti.TouchImageView
android:id=
"@+id/expanded_image_event"
android:id=
"@+id/expanded_image_event"
...
@@ -219,4 +237,5 @@
...
@@ -219,4 +237,5 @@
android:layout_height=
"match_parent"
android:layout_height=
"match_parent"
android:contentDescription=
"Zoomed Image"
android:contentDescription=
"Zoomed Image"
android:visibility=
"gone"
/>
android:visibility=
"gone"
/>
</FrameLayout>
</FrameLayout>
app/src/main/res/layout/fragment_feed.xml
View file @
1c32c302
...
@@ -24,7 +24,7 @@
...
@@ -24,7 +24,7 @@
android:layout_alignParentBottom=
"true"
android:layout_alignParentBottom=
"true"
android:layout_alignParentRight=
"true"
android:layout_alignParentRight=
"true"
android:layout_margin=
"16dp"
android:layout_margin=
"16dp"
android:src=
"@
android:drawable/ic_input_add
"
android:src=
"@
drawable/ic_add_black_24dp
"
android:tint=
"@android:color/black"
android:tint=
"@android:color/black"
android:visibility=
"gone"
/>
android:visibility=
"gone"
/>
...
...
app/src/main/res/layout/fragment_my_events.xml
View file @
1c32c302
...
@@ -25,7 +25,7 @@
...
@@ -25,7 +25,7 @@
android:layout_alignParentBottom=
"true"
android:layout_alignParentBottom=
"true"
android:layout_alignParentRight=
"true"
android:layout_alignParentRight=
"true"
android:layout_margin=
"16dp"
android:layout_margin=
"16dp"
android:src=
"@
android:drawable/ic_input_add
"
android:src=
"@
drawable/ic_add_black_24dp
"
android:tint=
"@android:color/black"
android:tint=
"@android:color/black"
android:visibility=
"gone"
/>
android:visibility=
"gone"
/>
...
...
app/src/main/res/values/drawables.xml
View file @
1c32c302
...
@@ -5,5 +5,4 @@
...
@@ -5,5 +5,4 @@
<item
name=
"ic_menu_manage"
type=
"drawable"
>
@android:drawable/ic_menu_manage
</item>
<item
name=
"ic_menu_manage"
type=
"drawable"
>
@android:drawable/ic_menu_manage
</item>
<item
name=
"ic_menu_share"
type=
"drawable"
>
@android:drawable/ic_menu_share
</item>
<item
name=
"ic_menu_share"
type=
"drawable"
>
@android:drawable/ic_menu_share
</item>
<item
name=
"ic_menu_send"
type=
"drawable"
>
@android:drawable/ic_menu_send
</item>
<item
name=
"ic_menu_send"
type=
"drawable"
>
@android:drawable/ic_menu_send
</item>
<item
name=
"ic_input_add"
type=
"drawable"
>
@android:drawable/ic_input_add
</item>
</resources>
</resources>
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment