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
7db0c351
Commit
7db0c351
authored
Oct 04, 2018
by
Preetam Ozarde
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add Location Details
parent
f144420d
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
63 additions
and
54 deletions
+63
-54
app/src/main/java/app/insti/fragment/FileComplaintFragment.java
...c/main/java/app/insti/fragment/FileComplaintFragment.java
+42
-24
app/src/main/res/layout/fragment_file_complaint.xml
app/src/main/res/layout/fragment_file_complaint.xml
+20
-30
app/src/main/res/values/strings.xml
app/src/main/res/values/strings.xml
+1
-0
No files found.
app/src/main/java/app/insti/fragment/FileComplaintFragment.java
View file @
7db0c351
...
...
@@ -19,6 +19,7 @@ import android.provider.MediaStore;
import
android.support.annotation.NonNull
;
import
android.support.annotation.Nullable
;
import
android.support.design.widget.CollapsingToolbarLayout
;
import
android.support.design.widget.CoordinatorLayout
;
import
android.support.design.widget.FloatingActionButton
;
import
android.support.v4.app.ActivityCompat
;
import
android.support.v4.app.Fragment
;
...
...
@@ -106,6 +107,7 @@ public class FileComplaintFragment extends Fragment {
private
CustomAutoCompleteTextView
autoCompleteTextView
;
private
EditText
editTextSuggestions
;
private
EditText
editTextTags
;
private
EditText
editTextLocationDetails
;
private
MapView
mMapView
;
GoogleMap
googleMap
;
private
TagView
tagView
;
...
...
@@ -134,6 +136,7 @@ public class FileComplaintFragment extends Fragment {
FusedLocationProviderClient
mFusedLocationClient
;
ProgressDialog
progressDialog
;
CollapsingToolbarLayout
collapsing_toolbar
;
LinearLayout
linear_layout_file_complaint
;
public
FileComplaintFragment
()
{
// Required empty public constructor
...
...
@@ -217,14 +220,17 @@ public class FileComplaintFragment extends Fragment {
viewPager
=
view
.
findViewById
(
R
.
id
.
complaint_image_view_pager
);
indicator
=
view
.
findViewById
(
R
.
id
.
indicator
);
linearLayoutAddImage
=
view
.
findViewById
(
R
.
id
.
linearLayoutAddImage
);
linear_layout_file_complaint
=
view
.
findViewById
(
R
.
id
.
linear_layout_file_complaint
);
floatingActionButton
=
view
.
findViewById
(
R
.
id
.
fabButton
);
floatingActionButton
.
show
();
floatingActionButton
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
public
void
onClick
(
View
v
)
{
giveOptionsToAddImage
();
}
});
ImageButton
imageButtonAddTags
=
(
ImageButton
)
view
.
findViewById
(
R
.
id
.
imageButtonAddTags
);
autoCompleteTextView
=
(
CustomAutoCompleteTextView
)
view
.
findViewById
(
R
.
id
.
dynamicAutoCompleteTextView
);
...
...
@@ -249,6 +255,8 @@ public class FileComplaintFragment extends Fragment {
editTextSuggestions
=
view
.
findViewById
(
R
.
id
.
editTextSuggestions
);
editTextLocationDetails
=
view
.
findViewById
(
R
.
id
.
editTextLocationDetails
);
editTextTags
=
view
.
findViewById
(
R
.
id
.
editTextTags
);
editTextTags
.
addTextChangedListener
(
new
TextWatcher
()
{
...
...
@@ -330,6 +338,8 @@ public class FileComplaintFragment extends Fragment {
});
// ends here
tagView
=
view
.
findViewById
(
R
.
id
.
tag_view
);
tagView
.
setOnTagDeleteListener
(
new
TagView
.
OnTagDeleteListener
()
{
...
...
@@ -577,10 +587,12 @@ public class FileComplaintFragment extends Fragment {
@Override
public
void
run
()
{
nestedScrollView
.
fullScroll
(
ScrollView
.
FOCUS_DOWN
);
}
});
}
private
void
prepareTags
()
{
tagList
=
new
ArrayList
<>();
try
{
...
...
@@ -595,16 +607,23 @@ public class FileComplaintFragment extends Fragment {
private
void
addComplaint
()
{
String
complaint
=
"Complaint: "
+
autoCompleteTextView
.
getText
().
toString
();
String
suggestion
=
null
;
String
locationDetails
=
null
;
Log
.
i
(
TAG
,
"Suggestion: "
+
editTextSuggestions
.
getText
().
toString
());
if
(!(
editTextSuggestions
.
getText
().
toString
().
isEmpty
()))
{
suggestion
=
"\nSuggestion: "
+
editTextSuggestions
.
getText
().
toString
();
}
else
{
suggestion
=
""
;
}
if
(
Location
==
null
)
{
Toast
.
makeText
(
getContext
(),
"Please specify the location"
,
Toast
.
LENGTH_LONG
).
show
();
if
(
!(
editTextLocationDetails
.
getText
().
toString
().
isEmpty
())
)
{
locationDetails
=
"\nLocation Details: "
+
editTextLocationDetails
.
getText
().
toString
();
}
else
{
ComplaintCreateRequest
complaintCreateRequest
=
new
ComplaintCreateRequest
(
complaint
+
suggestion
,
Address
,
(
float
)
Location
.
latitude
,
(
float
)
Location
.
longitude
,
Tags
,
uploadedImagesUrl
);
locationDetails
=
""
;
}
if
(
Location
==
null
)
{
Location
=
new
LatLng
(
19.1208
,
72.9014
);
Address
=
"IIT Area"
;
}
ComplaintCreateRequest
complaintCreateRequest
=
new
ComplaintCreateRequest
(
complaint
+
suggestion
+
locationDetails
,
Address
,
(
float
)
Location
.
latitude
,
(
float
)
Location
.
longitude
,
Tags
,
uploadedImagesUrl
);
RetrofitInterface
retrofitInterface
=
Utils
.
getRetrofitInterface
();
retrofitInterface
.
postComplaint
(
"sessionid="
+
getArguments
().
getString
(
Constants
.
SESSION_ID
),
complaintCreateRequest
).
enqueue
(
new
Callback
<
ComplaintCreateResponse
>()
{
@Override
...
...
@@ -627,7 +646,6 @@ public class FileComplaintFragment extends Fragment {
}
});
}
}
private
void
updateMap
(
LatLng
Location
,
String
Name
,
String
Address
,
int
cursor
)
{
Log
.
i
(
TAG
,
"In updateMap"
);
...
...
app/src/main/res/layout/fragment_file_complaint.xml
View file @
7db0c351
...
...
@@ -75,7 +75,7 @@
</android.support.design.widget.AppBarLayout>
<a
pp.insti.utils.Custom
ScrollView
<a
ndroid.support.v4.widget.Nested
ScrollView
android:id=
"@+id/nested_scrollview"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
...
...
@@ -190,31 +190,24 @@
android:layout_marginTop=
"20dp"
android:orientation=
"vertical"
>
<
LinearLayout
<
android.support.design.widget.TextInputLayout
xmlns:app=
"http://schemas.android.com/apk/res-auto"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:background=
"#ccc"
android:padding=
"10dp"
>
app:hintTextAppearance=
"@style/edit_text_hint_apperarance"
>
<RelativeLayout
<EditText
android:id=
"@+id/editTextLocationDetails"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
>
<TextView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"TAGS"
android:textColor=
"#4A4A4A"
android:textSize=
"16sp"
android:textStyle=
"bold"
/>
</RelativeLayout>
</LinearLayout>
android:gravity=
"top"
android:hint=
"@string/enter_location_details"
android:imeOptions=
"flagNoExtractUi|actionSearch"
android:inputType=
"textMultiLine"
android:minLines=
"3"
android:textColor=
"@android:color/black"
android:textSize=
"14sp"
/>
<View
android:layout_width=
"match_parent"
android:layout_height=
"7dp"
/>
</android.support.design.widget.TextInputLayout>
<com.cunoraz.tagview.TagView
android:id=
"@+id/tag_view"
...
...
@@ -222,10 +215,6 @@
android:layout_height=
"match_parent"
android:layout_margin=
"10dp"
/>
<View
android:layout_width=
"match_parent"
android:layout_height=
"7dp"
/>
</LinearLayout>
<LinearLayout
...
...
@@ -245,7 +234,7 @@
android:id=
"@+id/editTextTags"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:hint=
"Add
more
Tags"
android:hint=
"Add Tags"
android:inputType=
"text"
android:textColor=
"@android:color/black"
android:textColorHint=
"#66000000"
...
...
@@ -274,7 +263,9 @@
android:id=
"@+id/tag_populate"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:layout_margin=
"10dp"
/>
android:layout_margin=
"10dp"
android:focusable=
"true"
android:focusableInTouchMode=
"true"
/>
</ScrollView>
...
...
@@ -286,7 +277,7 @@
</LinearLayout>
</a
pp.insti.utils.Custom
ScrollView>
</a
ndroid.support.v4.widget.Nested
ScrollView>
<android.support.design.widget.FloatingActionButton
android:id=
"@+id/fabButton"
...
...
@@ -302,8 +293,7 @@
android:src=
"@drawable/ic_add_a_photo_black_24dp"
app:backgroundTint=
"@color/colorSecondary"
app:borderWidth=
"0dp"
app:fabSize=
"normal"
android:padding=
"100dp"
/>
app:fabSize=
"normal"
/>
</android.support.design.widget.CoordinatorLayout>
...
...
app/src/main/res/values/strings.xml
View file @
7db0c351
...
...
@@ -57,4 +57,5 @@
<string
name=
"getting_current_location"
>
Getting current location. Please try after some time
</string>
<string
name=
"GPS_not_enables"
>
GPS is not enabled!
</string>
<string
name=
"no_permission"
>
No permission!
</string>
<string
name=
"enter_location_details"
>
Enter Location Details
</string>
</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