Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
J
JoinTheCity
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Rafal
JoinTheCity
Commits
0583da2f
Commit
0583da2f
authored
Jan 17, 2016
by
Eryk Leniart
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
last
parent
22fc36b4
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
29 additions
and
23 deletions
+29
-23
AndroidManifest.xml
JoinTheCityAPP/app/src/main/AndroidManifest.xml
+1
-1
ApiListAdapter.java
.../anotherlineofcode/com/jointhecityapp/ApiListAdapter.java
+3
-2
MapsActivity.java
...va/anotherlineofcode/com/jointhecityapp/MapsActivity.java
+17
-13
back.jpg
JoinTheCityAPP/app/src/main/res/drawable/back.jpg
+0
-0
activity_add_api.xml
JoinTheCityAPP/app/src/main/res/layout/activity_add_api.xml
+1
-0
activity_login_and_registration.xml
...p/src/main/res/layout/activity_login_and_registration.xml
+1
-0
activity_main.xml
JoinTheCityAPP/app/src/main/res/layout/activity_main.xml
+3
-1
api_item.xml
JoinTheCityAPP/app/src/main/res/layout/api_item.xml
+3
-6
back.png
JoinTheCityAPP/app/src/main/res/mipmap-mdpi/back.png
+0
-0
No files found.
JoinTheCityAPP/app/src/main/AndroidManifest.xml
View file @
0583da2f
...
@@ -14,7 +14,7 @@
...
@@ -14,7 +14,7 @@
<application
<application
android:allowBackup=
"true"
android:allowBackup=
"true"
android:icon=
"@
mipmap/ic_launcher
"
android:icon=
"@
drawable/logo
"
android:label=
"@string/app_name"
android:label=
"@string/app_name"
android:theme=
"@style/Theme.AppCompat.Light"
android:theme=
"@style/Theme.AppCompat.Light"
tools:replace=
"android:icon"
>
tools:replace=
"android:icon"
>
...
...
JoinTheCityAPP/app/src/main/java/anotherlineofcode/com/jointhecityapp/ApiListAdapter.java
View file @
0583da2f
...
@@ -8,6 +8,7 @@ import android.view.ViewGroup;
...
@@ -8,6 +8,7 @@ import android.view.ViewGroup;
import
android.widget.ArrayAdapter
;
import
android.widget.ArrayAdapter
;
import
android.widget.Button
;
import
android.widget.Button
;
import
android.widget.ImageView
;
import
android.widget.ImageView
;
import
android.widget.ListView
;
import
android.widget.TextView
;
import
android.widget.TextView
;
import
com.nostra13.universalimageloader.core.ImageLoader
;
import
com.nostra13.universalimageloader.core.ImageLoader
;
...
@@ -21,7 +22,7 @@ public class ApiListAdapter extends ArrayAdapter<ApiObject> {
...
@@ -21,7 +22,7 @@ public class ApiListAdapter extends ArrayAdapter<ApiObject> {
}
}
@Override
@Override
public
View
getView
(
int
position
,
View
convertView
,
ViewGroup
parent
)
{
public
View
getView
(
final
int
position
,
View
convertView
,
final
ViewGroup
parent
)
{
// Get the data item for this position
// Get the data item for this position
ApiObject
api
=
getItem
(
position
);
ApiObject
api
=
getItem
(
position
);
// Check if an existing view is being reused, otherwise inflate the view
// Check if an existing view is being reused, otherwise inflate the view
...
@@ -42,7 +43,7 @@ public class ApiListAdapter extends ArrayAdapter<ApiObject> {
...
@@ -42,7 +43,7 @@ public class ApiListAdapter extends ArrayAdapter<ApiObject> {
startUsing
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
startUsing
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
@Override
public
void
onClick
(
View
v
)
{
public
void
onClick
(
View
v
)
{
Log
.
d
(
"CLICK"
,
v
.
toString
()
);
((
ListView
)
parent
).
performItemClick
(
v
,
position
,
0
);
}
}
});
});
...
...
JoinTheCityAPP/app/src/main/java/anotherlineofcode/com/jointhecityapp/MapsActivity.java
View file @
0583da2f
...
@@ -47,7 +47,7 @@ public class MapsActivity extends FragmentActivity implements OnMapReadyCallback
...
@@ -47,7 +47,7 @@ public class MapsActivity extends FragmentActivity implements OnMapReadyCallback
// Obtain the SupportMapFragment and get notified when the map is ready to be used.
// Obtain the SupportMapFragment and get notified when the map is ready to be used.
SupportMapFragment
mapFragment
=
(
SupportMapFragment
)
getSupportFragmentManager
()
SupportMapFragment
mapFragment
=
(
SupportMapFragment
)
getSupportFragmentManager
()
.
findFragmentById
(
R
.
id
.
map
);
.
findFragmentById
(
R
.
id
.
map
);
mapFragment
.
getMap
().
moveCamera
(
CameraUpdateFactory
.
newLatLngZoom
(
new
LatLng
(
52.0
,
20.0
),
5
.0f
));
mapFragment
.
getMap
().
moveCamera
(
CameraUpdateFactory
.
newLatLngZoom
(
new
LatLng
(
52.0
,
20.0
),
6
.0f
));
mapFragment
.
getMapAsync
(
this
);
mapFragment
.
getMapAsync
(
this
);
}
}
...
@@ -65,6 +65,13 @@ public class MapsActivity extends FragmentActivity implements OnMapReadyCallback
...
@@ -65,6 +65,13 @@ public class MapsActivity extends FragmentActivity implements OnMapReadyCallback
public
void
onMapReady
(
GoogleMap
googleMap
)
{
public
void
onMapReady
(
GoogleMap
googleMap
)
{
mMap
=
googleMap
;
mMap
=
googleMap
;
// Display progress bar
final
SweetAlertDialog
pDialog
=
new
SweetAlertDialog
(
this
,
SweetAlertDialog
.
PROGRESS_TYPE
);
pDialog
.
getProgressHelper
().
setBarColor
(
Color
.
parseColor
(
"#9FC967"
));
pDialog
.
setTitleText
(
"Pobieranie danych..."
);
pDialog
.
setCancelable
(
false
);
pDialog
.
show
();
client
=
new
AsyncHttpClient
();
client
=
new
AsyncHttpClient
();
client
.
addHeader
(
"Authorization"
,
"Token "
+
sharedPreferences
.
getString
(
"token"
,
""
));
client
.
addHeader
(
"Authorization"
,
"Token "
+
sharedPreferences
.
getString
(
"token"
,
""
));
...
@@ -74,13 +81,14 @@ public class MapsActivity extends FragmentActivity implements OnMapReadyCallback
...
@@ -74,13 +81,14 @@ public class MapsActivity extends FragmentActivity implements OnMapReadyCallback
client
.
get
(
url
+
"?method=object"
,
new
AsyncHttpResponseHandler
()
{
client
.
get
(
url
+
"?method=object"
,
new
AsyncHttpResponseHandler
()
{
@Override
@Override
public
void
onSuccess
(
int
statusCode
,
Header
[]
headers
,
byte
[]
responseBody
)
{
public
void
onSuccess
(
int
statusCode
,
Header
[]
headers
,
byte
[]
responseBody
)
{
pDialog
.
dismiss
();
client
=
null
;
client
=
null
;
displayMarkers
();
displayMarkers
();
}
}
@Override
@Override
public
void
onFailure
(
int
statusCode
,
Header
[]
headers
,
byte
[]
responseBody
,
Throwable
error
)
{
public
void
onFailure
(
int
statusCode
,
Header
[]
headers
,
byte
[]
responseBody
,
Throwable
error
)
{
pDialog
.
dismiss
();
}
}
});
});
...
@@ -92,13 +100,6 @@ public class MapsActivity extends FragmentActivity implements OnMapReadyCallback
...
@@ -92,13 +100,6 @@ public class MapsActivity extends FragmentActivity implements OnMapReadyCallback
client
=
new
AsyncHttpClient
();
client
=
new
AsyncHttpClient
();
client
.
addHeader
(
"Authorization"
,
"Token "
+
sharedPreferences
.
getString
(
"token"
,
""
));
client
.
addHeader
(
"Authorization"
,
"Token "
+
sharedPreferences
.
getString
(
"token"
,
""
));
// Display progress bar
final
SweetAlertDialog
pDialog
=
new
SweetAlertDialog
(
this
,
SweetAlertDialog
.
PROGRESS_TYPE
);
pDialog
.
getProgressHelper
().
setBarColor
(
Color
.
parseColor
(
"#9FC967"
));
pDialog
.
setTitleText
(
"Pobieranie danych..."
);
pDialog
.
setCancelable
(
false
);
pDialog
.
show
();
client
.
get
(
url
+
"parssed/?format=json"
,
new
JsonHttpResponseHandler
()
{
client
.
get
(
url
+
"parssed/?format=json"
,
new
JsonHttpResponseHandler
()
{
@Override
@Override
...
@@ -106,8 +107,6 @@ public class MapsActivity extends FragmentActivity implements OnMapReadyCallback
...
@@ -106,8 +107,6 @@ public class MapsActivity extends FragmentActivity implements OnMapReadyCallback
super
.
onSuccess
(
statusCode
,
headers
,
response
);
super
.
onSuccess
(
statusCode
,
headers
,
response
);
client
=
null
;
client
=
null
;
pDialog
.
dismiss
();
try
{
try
{
Log
.
d
(
"UPRARSED"
,
response
.
toString
());
Log
.
d
(
"UPRARSED"
,
response
.
toString
());
...
@@ -116,9 +115,15 @@ public class MapsActivity extends FragmentActivity implements OnMapReadyCallback
...
@@ -116,9 +115,15 @@ public class MapsActivity extends FragmentActivity implements OnMapReadyCallback
JSONObject
object
=
response
.
getJSONObject
(
i
);
JSONObject
object
=
response
.
getJSONObject
(
i
);
Log
.
d
(
"Object"
,
object
.
toString
());
Log
.
d
(
"Object"
,
object
.
toString
());
LatLng
camera
=
new
LatLng
(
object
.
getDouble
(
"latitude"
),
object
.
getDouble
(
"longitude"
));
LatLng
camera
=
new
LatLng
(
object
.
getDouble
(
"latitude"
),
object
.
getDouble
(
"longitude"
));
String
snippet
=
""
;
try
{
snippet
=
object
.
getString
(
"address"
);
}
catch
(
JSONException
e
)
{
e
.
printStackTrace
();
}
// Add a marker in Sydney and move the camera
// Add a marker in Sydney and move the camera
mMap
.
addMarker
(
new
MarkerOptions
().
position
(
camera
).
title
(
object
.
getString
(
"name"
)).
snippet
(
object
.
getString
(
"address"
)
));
mMap
.
addMarker
(
new
MarkerOptions
().
position
(
camera
).
title
(
object
.
getString
(
"name"
)).
snippet
(
snippet
));
}
}
//Move the camera to the user's location and zoom in!
//Move the camera to the user's location and zoom in!
...
@@ -133,7 +138,6 @@ public class MapsActivity extends FragmentActivity implements OnMapReadyCallback
...
@@ -133,7 +138,6 @@ public class MapsActivity extends FragmentActivity implements OnMapReadyCallback
super
.
onFailure
(
statusCode
,
headers
,
responseString
,
throwable
);
super
.
onFailure
(
statusCode
,
headers
,
responseString
,
throwable
);
client
=
null
;
client
=
null
;
pDialog
.
dismiss
();
// Display error dialog
// Display error dialog
new
SweetAlertDialog
(
context
,
SweetAlertDialog
.
ERROR_TYPE
)
new
SweetAlertDialog
(
context
,
SweetAlertDialog
.
ERROR_TYPE
)
...
...
JoinTheCityAPP/app/src/main/res/drawable/back.jpg
0 → 100644
View file @
0583da2f
6.06 KB
JoinTheCityAPP/app/src/main/res/layout/activity_add_api.xml
View file @
0583da2f
...
@@ -4,6 +4,7 @@
...
@@ -4,6 +4,7 @@
xmlns:app=
"http://schemas.android.com/apk/res-auto"
xmlns:app=
"http://schemas.android.com/apk/res-auto"
xmlns:tools=
"http://schemas.android.com/tools"
android:layout_width=
"match_parent"
xmlns:tools=
"http://schemas.android.com/tools"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:fitsSystemWindows=
"true"
android:layout_height=
"match_parent"
android:fitsSystemWindows=
"true"
android:background=
"@drawable/back"
tools:context=
"anotherlineofcode.com.jointhecityapp.AddApiActivity"
>
tools:context=
"anotherlineofcode.com.jointhecityapp.AddApiActivity"
>
<android.support.design.widget.AppBarLayout
android:layout_height=
"wrap_content"
<android.support.design.widget.AppBarLayout
android:layout_height=
"wrap_content"
...
...
JoinTheCityAPP/app/src/main/res/layout/activity_login_and_registration.xml
View file @
0583da2f
...
@@ -5,6 +5,7 @@
...
@@ -5,6 +5,7 @@
android:paddingTop=
"@dimen/activity_vertical_margin"
android:paddingTop=
"@dimen/activity_vertical_margin"
android:paddingBottom=
"@dimen/activity_vertical_margin"
android:paddingBottom=
"@dimen/activity_vertical_margin"
android:orientation=
"vertical"
android:orientation=
"vertical"
android:background=
"@drawable/back"
tools:context=
"anotherlineofcode.com.jointhecityapp.LoginAndRegistrationActivity"
>
tools:context=
"anotherlineofcode.com.jointhecityapp.LoginAndRegistrationActivity"
>
<!--android:background="@drawable/background"-->
<!--android:background="@drawable/background"-->
<ImageView
android:id=
"@+id/logo"
<ImageView
android:id=
"@+id/logo"
...
...
JoinTheCityAPP/app/src/main/res/layout/activity_main.xml
View file @
0583da2f
...
@@ -3,7 +3,9 @@
...
@@ -3,7 +3,9 @@
android:layout_height=
"match_parent"
android:paddingLeft=
"@dimen/activity_horizontal_margin"
android:layout_height=
"match_parent"
android:paddingLeft=
"@dimen/activity_horizontal_margin"
android:paddingRight=
"@dimen/activity_horizontal_margin"
android:paddingRight=
"@dimen/activity_horizontal_margin"
android:paddingTop=
"@dimen/activity_vertical_margin"
android:paddingTop=
"@dimen/activity_vertical_margin"
android:paddingBottom=
"@dimen/activity_vertical_margin"
tools:context=
".MainActivity"
>
android:paddingBottom=
"@dimen/activity_vertical_margin"
android:background=
"@drawable/back"
tools:context=
".MainActivity"
>
<!--android:background="@drawable/background">-->
<!--android:background="@drawable/background">-->
<android.support.v7.widget.RecyclerView
<android.support.v7.widget.RecyclerView
...
...
JoinTheCityAPP/app/src/main/res/layout/api_item.xml
View file @
0583da2f
...
@@ -13,8 +13,7 @@
...
@@ -13,8 +13,7 @@
android:layout_rowSpan=
"2"
android:layout_rowSpan=
"2"
android:layout_column=
"0"
android:layout_column=
"0"
android:layout_row=
"0"
android:layout_row=
"0"
android:padding=
"5dp"
android:padding=
"5dp"
/>
android:src=
"@drawable/ic_launcher"
/>
<TextView
android:id=
"@+id/name"
<TextView
android:id=
"@+id/name"
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
...
@@ -22,15 +21,13 @@
...
@@ -22,15 +21,13 @@
android:layout_column=
"1"
android:layout_column=
"1"
android:layout_row=
"0"
android:layout_row=
"0"
android:maxLines=
"1"
android:maxLines=
"1"
android:singleLine=
"true"
android:singleLine=
"true"
/>
android:text=
"Name"
/>
<TextView
android:id=
"@+id/description"
<TextView
android:id=
"@+id/description"
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_column=
"1"
android:layout_column=
"1"
android:layout_row=
"1"
android:layout_row=
"1"
/>
android:text=
"Description"
/>
<Button
android:id=
"@+id/start"
<Button
android:id=
"@+id/start"
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
...
...
JoinTheCityAPP/app/src/main/res/mipmap-mdpi/back.png
0 → 100644
View file @
0583da2f
6.06 KB
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