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
5622d05e
Commit
5622d05e
authored
Jan 17, 2016
by
Eryk Leniart
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
api
parent
4c7196ee
Hide whitespace changes
Inline
Side-by-side
Showing
33 changed files
with
672 additions
and
114 deletions
+672
-114
app.iml
JoinTheCityAPP/app/app.iml
+1
-0
build.gradle
JoinTheCityAPP/app/build.gradle
+1
-0
AndroidManifest.xml
JoinTheCityAPP/app/src/main/AndroidManifest.xml
+11
-1
AddApiActivity.java
.../anotherlineofcode/com/jointhecityapp/AddApiActivity.java
+168
-0
ApiListAdapter.java
.../anotherlineofcode/com/jointhecityapp/ApiListAdapter.java
+52
-0
ApiObject.java
.../java/anotherlineofcode/com/jointhecityapp/ApiObject.java
+23
-5
Globals.java
...in/java/anotherlineofcode/com/jointhecityapp/Globals.java
+9
-0
LoginAndRegistrationActivity.java
...code/com/jointhecityapp/LoginAndRegistrationActivity.java
+3
-2
MainActivity.java
...va/anotherlineofcode/com/jointhecityapp/MainActivity.java
+92
-51
MapsActivity.java
...va/anotherlineofcode/com/jointhecityapp/MapsActivity.java
+105
-8
RecyclerViewAdapter.java
...herlineofcode/com/jointhecityapp/RecyclerViewAdapter.java
+4
-1
RecyclerViewHolders.java
...herlineofcode/com/jointhecityapp/RecyclerViewHolders.java
+9
-1
api_list.png
JoinTheCityAPP/app/src/main/res/drawable/api_list.png
+0
-0
background.png
JoinTheCityAPP/app/src/main/res/drawable/background.png
+0
-0
cross.png
JoinTheCityAPP/app/src/main/res/drawable/cross.png
+0
-0
login.png
JoinTheCityAPP/app/src/main/res/drawable/login.png
+0
-0
logo.png
JoinTheCityAPP/app/src/main/res/drawable/logo.png
+0
-0
logo_bar.png
JoinTheCityAPP/app/src/main/res/drawable/logo_bar.png
+0
-0
message.png
JoinTheCityAPP/app/src/main/res/drawable/message.png
+0
-0
or.png
JoinTheCityAPP/app/src/main/res/drawable/or.png
+0
-0
register.png
JoinTheCityAPP/app/src/main/res/drawable/register.png
+0
-0
rounded_focused_input.xml
...tyAPP/app/src/main/res/drawable/rounded_focused_input.xml
+9
-0
rounded_input.xml
JoinTheCityAPP/app/src/main/res/drawable/rounded_input.xml
+14
-0
rounded_unfocused_input.xml
...APP/app/src/main/res/drawable/rounded_unfocused_input.xml
+9
-0
activity_add_api.xml
JoinTheCityAPP/app/src/main/res/layout/activity_add_api.xml
+21
-0
activity_login_and_registration.xml
...p/src/main/res/layout/activity_login_and_registration.xml
+47
-9
activity_main.xml
JoinTheCityAPP/app/src/main/res/layout/activity_main.xml
+14
-9
api_item.xml
JoinTheCityAPP/app/src/main/res/layout/api_item.xml
+44
-0
card_view_list.xml
JoinTheCityAPP/app/src/main/res/layout/card_view_list.xml
+3
-6
content_add_api.xml
JoinTheCityAPP/app/src/main/res/layout/content_add_api.xml
+20
-0
menu_main.xml
JoinTheCityAPP/app/src/main/res/menu/menu_main.xml
+4
-21
colors.xml
JoinTheCityAPP/app/src/main/res/values/colors.xml
+8
-0
strings.xml
JoinTheCityAPP/app/src/main/res/values/strings.xml
+1
-0
No files found.
JoinTheCityAPP/app/app.iml
View file @
5622d05e
...
@@ -150,6 +150,7 @@
...
@@ -150,6 +150,7 @@
<orderEntry
type=
"library"
exported=
""
name=
"play-services-games-8.3.0"
level=
"project"
/>
<orderEntry
type=
"library"
exported=
""
name=
"play-services-games-8.3.0"
level=
"project"
/>
<orderEntry
type=
"library"
exported=
""
name=
"play-services-gcm-8.3.0"
level=
"project"
/>
<orderEntry
type=
"library"
exported=
""
name=
"play-services-gcm-8.3.0"
level=
"project"
/>
<orderEntry
type=
"library"
exported=
""
name=
"play-services-safetynet-8.3.0"
level=
"project"
/>
<orderEntry
type=
"library"
exported=
""
name=
"play-services-safetynet-8.3.0"
level=
"project"
/>
<orderEntry
type=
"library"
exported=
""
name=
"universal-image-loader-1.9.4"
level=
"project"
/>
<orderEntry
type=
"library"
exported=
""
name=
"materialish-progress-1.0"
level=
"project"
/>
<orderEntry
type=
"library"
exported=
""
name=
"materialish-progress-1.0"
level=
"project"
/>
<orderEntry
type=
"library"
exported=
""
name=
"design-23.1.1"
level=
"project"
/>
<orderEntry
type=
"library"
exported=
""
name=
"design-23.1.1"
level=
"project"
/>
<orderEntry
type=
"library"
exported=
""
name=
"library-1.3"
level=
"project"
/>
<orderEntry
type=
"library"
exported=
""
name=
"library-1.3"
level=
"project"
/>
...
...
JoinTheCityAPP/app/build.gradle
View file @
5622d05e
...
@@ -30,4 +30,5 @@ dependencies {
...
@@ -30,4 +30,5 @@ dependencies {
compile
'com.android.support:design:23.1.1'
compile
'com.android.support:design:23.1.1'
compile
'com.android.support:cardview-v7:23.1.1'
compile
'com.android.support:cardview-v7:23.1.1'
compile
'com.android.support:recyclerview-v7:23.1.1'
compile
'com.android.support:recyclerview-v7:23.1.1'
compile
'com.nostra13.universalimageloader:universal-image-loader:1.9.4'
}
}
JoinTheCityAPP/app/src/main/AndroidManifest.xml
View file @
5622d05e
...
@@ -30,7 +30,8 @@
...
@@ -30,7 +30,8 @@
</activity>
</activity>
<activity
<activity
android:name=
".LoginAndRegistrationActivity"
android:name=
".LoginAndRegistrationActivity"
android:label=
"@string/title_activity_login_and_registration"
>
android:label=
"@string/title_activity_login_and_registration"
android:theme=
"@style/Theme.AppCompat.Light.NoActionBar"
>
</activity>
</activity>
<!--
<!--
The API key for Google Maps-based APIs is defined as a string resource.
The API key for Google Maps-based APIs is defined as a string resource.
...
@@ -60,6 +61,15 @@
...
@@ -60,6 +61,15 @@
android:name=
"android.support.PARENT_ACTIVITY"
android:name=
"android.support.PARENT_ACTIVITY"
android:value=
"anotherlineofcode.com.jointhecityapp.MainActivity"
/>
android:value=
"anotherlineofcode.com.jointhecityapp.MainActivity"
/>
</activity>
</activity>
<activity
android:name=
".AddApiActivity"
android:label=
"@string/title_activity_add_api"
android:parentActivityName=
".MainActivity"
android:theme=
"@style/Theme.AppCompat.Light.NoActionBar"
>
<meta-data
android:name=
"android.support.PARENT_ACTIVITY"
android:value=
"anotherlineofcode.com.jointhecityapp.MainActivity"
/>
</activity>
</application>
</application>
</manifest>
</manifest>
JoinTheCityAPP/app/src/main/java/anotherlineofcode/com/jointhecityapp/AddApiActivity.java
0 → 100644
View file @
5622d05e
package
anotherlineofcode
.
com
.
jointhecityapp
;
import
android.app.Activity
;
import
android.content.Context
;
import
android.content.SharedPreferences
;
import
android.graphics.Color
;
import
android.os.Bundle
;
import
android.support.design.widget.FloatingActionButton
;
import
android.support.design.widget.Snackbar
;
import
android.support.v7.app.AppCompatActivity
;
import
android.support.v7.widget.Toolbar
;
import
android.util.Log
;
import
android.view.View
;
import
android.widget.AdapterView
;
import
android.widget.ListView
;
import
com.loopj.android.http.AsyncHttpClient
;
import
com.loopj.android.http.AsyncHttpResponseHandler
;
import
com.loopj.android.http.RequestParams
;
import
org.json.JSONException
;
import
org.json.JSONObject
;
import
java.util.ArrayList
;
import
cn.pedant.SweetAlert.SweetAlertDialog
;
import
cz.msebera.android.httpclient.Header
;
public
class
AddApiActivity
extends
AppCompatActivity
{
private
AsyncHttpClient
client
;
private
SharedPreferences
sharedPreferences
;
private
Context
context
=
this
;
private
ArrayList
<
ApiObject
>
apiList
;
private
ListView
listView
;
@Override
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
setContentView
(
R
.
layout
.
activity_add_api
);
Toolbar
toolbar
=
(
Toolbar
)
findViewById
(
R
.
id
.
toolbar
);
setSupportActionBar
(
toolbar
);
listView
=
(
ListView
)
findViewById
(
R
.
id
.
listview_api
);
sharedPreferences
=
getSharedPreferences
(
"JoinTheCityPreferences"
,
Context
.
MODE_PRIVATE
);
downloadApiList
();
displayApiList
();
AdapterView
.
OnItemClickListener
itemClickListener
=
new
AdapterView
.
OnItemClickListener
(){
@Override
public
void
onItemClick
(
AdapterView
<?>
parent
,
View
view
,
int
position
,
long
id
)
{
ApiObject
selected
=
(
ApiObject
)
parent
.
getItemAtPosition
(
position
);
saveApi
(
selected
.
getUrl
());
Log
.
d
(
"SELECT"
,
selected
.
getUrl
());
}
};
listView
.
setOnItemClickListener
(
itemClickListener
);
}
private
void
saveApi
(
String
url
){
client
=
new
AsyncHttpClient
();
client
.
addHeader
(
"Authorization"
,
"Token "
+
sharedPreferences
.
getString
(
"token"
,
""
));
Log
.
d
(
"URL"
,
url
+
"add/"
);
// Display progress bar
final
SweetAlertDialog
pDialog
=
new
SweetAlertDialog
(
this
,
SweetAlertDialog
.
PROGRESS_TYPE
);
pDialog
.
getProgressHelper
().
setBarColor
(
Color
.
parseColor
(
"#9FC967"
));
pDialog
.
setTitleText
(
"Zapisywanie danych..."
);
pDialog
.
setCancelable
(
false
);
pDialog
.
show
();
client
.
get
(
url
+
"add/"
,
new
AsyncHttpResponseHandler
()
{
@Override
public
void
onSuccess
(
int
statusCode
,
Header
[]
headers
,
byte
[]
responseBody
)
{
client
=
null
;
pDialog
.
dismiss
();
// Display success dialog
SweetAlertDialog
sDialog
=
new
SweetAlertDialog
(
context
,
SweetAlertDialog
.
SUCCESS_TYPE
)
.
setTitleText
(
"Dodano API!"
)
.
setConfirmClickListener
(
new
SweetAlertDialog
.
OnSweetClickListener
()
{
@Override
public
void
onClick
(
SweetAlertDialog
sDialog
)
{
sDialog
.
dismissWithAnimation
();
// Finish activity
finish
();
}
});
sDialog
.
setCancelable
(
false
);
sDialog
.
show
();
}
@Override
public
void
onFailure
(
int
statusCode
,
Header
[]
headers
,
byte
[]
responseBody
,
Throwable
error
)
{
client
=
null
;
pDialog
.
dismiss
();
// Display error dialog
new
SweetAlertDialog
(
context
,
SweetAlertDialog
.
ERROR_TYPE
)
.
setTitleText
(
"Błąd"
)
.
setContentText
(
error
.
toString
())
.
show
();
Log
.
e
(
"ERROR"
,
error
.
toString
());
}
});
}
private
void
downloadApiList
(){
client
=
new
AsyncHttpClient
();
// 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
(
getString
(
R
.
string
.
api_url
)
+
"api/api/?only_new=True"
,
new
AsyncHttpResponseHandler
()
{
@Override
public
void
onSuccess
(
int
statusCode
,
Header
[]
headers
,
byte
[]
responseBody
)
{
client
=
null
;
pDialog
.
dismiss
();
// Retrieve server response
JSONObject
jsonResponse
=
JSONParser
.
parseObject
(
responseBody
);
try
{
apiList
=
new
ArrayList
<>();
for
(
int
i
=
0
;
i
<
jsonResponse
.
getInt
(
"count"
);
i
++)
{
JSONObject
api
=
jsonResponse
.
getJSONArray
(
"results"
).
getJSONObject
(
i
);
apiList
.
add
(
new
ApiObject
(
api
.
getInt
(
"id"
),
api
.
getString
(
"name"
),
api
.
getString
(
"description"
),
api
.
getString
(
"icon"
),
api
.
getString
(
"url"
)));
}
listView
.
setAdapter
(
new
ApiListAdapter
(
context
,
apiList
));
}
catch
(
JSONException
e
)
{
e
.
printStackTrace
();
}
}
@Override
public
void
onFailure
(
int
statusCode
,
Header
[]
headers
,
byte
[]
responseBody
,
Throwable
error
)
{
client
=
null
;
pDialog
.
dismiss
();
// Display error dialog
new
SweetAlertDialog
(
context
,
SweetAlertDialog
.
ERROR_TYPE
)
.
setTitleText
(
"Błąd"
)
.
setContentText
(
error
.
toString
())
.
show
();
}
});
}
public
void
displayApiList
(){
}
}
JoinTheCityAPP/app/src/main/java/anotherlineofcode/com/jointhecityapp/ApiListAdapter.java
0 → 100644
View file @
5622d05e
package
anotherlineofcode
.
com
.
jointhecityapp
;
import
android.content.Context
;
import
android.util.Log
;
import
android.view.LayoutInflater
;
import
android.view.View
;
import
android.view.ViewGroup
;
import
android.widget.ArrayAdapter
;
import
android.widget.Button
;
import
android.widget.ImageView
;
import
android.widget.TextView
;
import
com.nostra13.universalimageloader.core.ImageLoader
;
import
java.util.ArrayList
;
public
class
ApiListAdapter
extends
ArrayAdapter
<
ApiObject
>
{
public
ApiListAdapter
(
Context
context
,
ArrayList
<
ApiObject
>
users
)
{
super
(
context
,
0
,
users
);
}
@Override
public
View
getView
(
int
position
,
View
convertView
,
ViewGroup
parent
)
{
// Get the data item for this position
ApiObject
api
=
getItem
(
position
);
// Check if an existing view is being reused, otherwise inflate the view
if
(
convertView
==
null
)
{
convertView
=
LayoutInflater
.
from
(
getContext
()).
inflate
(
R
.
layout
.
api_item
,
parent
,
false
);
}
// Lookup view for data population
ImageView
picture
=
(
ImageView
)
convertView
.
findViewById
(
R
.
id
.
photo
);
TextView
name
=
(
TextView
)
convertView
.
findViewById
(
R
.
id
.
name
);
TextView
description
=
(
TextView
)
convertView
.
findViewById
(
R
.
id
.
description
);
Button
startUsing
=
(
Button
)
convertView
.
findViewById
(
R
.
id
.
start
);
// Populate the data into the template view using the data object
ImageLoader
.
getInstance
().
displayImage
(
api
.
getImageUrl
(),
picture
);
name
.
setText
(
api
.
getName
());
description
.
setText
(
api
.
getDescription
());
startUsing
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
public
void
onClick
(
View
v
)
{
Log
.
d
(
"CLICK"
,
v
.
toString
());
}
});
// Return the completed view to render on screen
return
convertView
;
}
}
JoinTheCityAPP/app/src/main/java/anotherlineofcode/com/jointhecityapp/ApiObject.java
View file @
5622d05e
...
@@ -2,19 +2,37 @@ package anotherlineofcode.com.jointhecityapp;
...
@@ -2,19 +2,37 @@ package anotherlineofcode.com.jointhecityapp;
public
class
ApiObject
{
public
class
ApiObject
{
private
int
id
;
private
String
imageUrl
;
private
String
name
;
private
String
name
;
private
int
photo
;
private
String
description
;
private
String
url
;
ApiObject
(
String
name
,
int
photo
){
ApiObject
(
int
id
,
String
name
,
String
description
,
String
imageUrl
,
String
url
){
this
.
id
=
id
;
this
.
name
=
name
;
this
.
name
=
name
;
this
.
photo
=
photo
;
this
.
description
=
description
;
this
.
imageUrl
=
imageUrl
;
this
.
url
=
url
;
}
public
int
getId
()
{
return
id
;
}
}
public
String
getName
()
{
public
String
getName
()
{
return
name
;
return
name
;
}
}
public
int
getPhoto
()
{
public
String
getDescription
()
{
return
photo
;
return
description
;
}
public
String
getImageUrl
()
{
return
imageUrl
;
}
public
String
getUrl
()
{
return
url
;
}
}
}
}
JoinTheCityAPP/app/src/main/java/anotherlineofcode/com/jointhecityapp/Globals.java
0 → 100644
View file @
5622d05e
package
anotherlineofcode
.
com
.
jointhecityapp
;
import
java.util.ArrayList
;
import
java.util.List
;
public
class
Globals
{
public
static
List
<
ApiObject
>
usedApi
=
new
ArrayList
<>();
}
JoinTheCityAPP/app/src/main/java/anotherlineofcode/com/jointhecityapp/LoginAndRegistrationActivity.java
View file @
5622d05e
...
@@ -14,6 +14,7 @@ import android.view.View;
...
@@ -14,6 +14,7 @@ import android.view.View;
import
android.view.inputmethod.EditorInfo
;
import
android.view.inputmethod.EditorInfo
;
import
android.widget.Button
;
import
android.widget.Button
;
import
android.widget.EditText
;
import
android.widget.EditText
;
import
android.widget.ImageView
;
import
android.widget.TextView
;
import
android.widget.TextView
;
import
com.loopj.android.http.AsyncHttpClient
;
import
com.loopj.android.http.AsyncHttpClient
;
...
@@ -30,7 +31,7 @@ public class LoginAndRegistrationActivity extends AppCompatActivity {
...
@@ -30,7 +31,7 @@ public class LoginAndRegistrationActivity extends AppCompatActivity {
private
AsyncHttpClient
client
;
private
AsyncHttpClient
client
;
private
SharedPreferences
sharedPreferences
;
private
SharedPreferences
sharedPreferences
;
private
Button
mLoginButton
;
private
ImageView
mLoginButton
;
private
EditText
mUsername
,
mPassword
;
private
EditText
mUsername
,
mPassword
;
private
View
focusView
;
private
View
focusView
;
private
Context
context
=
this
;
private
Context
context
=
this
;
...
@@ -43,7 +44,7 @@ public class LoginAndRegistrationActivity extends AppCompatActivity {
...
@@ -43,7 +44,7 @@ public class LoginAndRegistrationActivity extends AppCompatActivity {
sharedPreferences
=
getSharedPreferences
(
"JoinTheCityPreferences"
,
Context
.
MODE_PRIVATE
);
sharedPreferences
=
getSharedPreferences
(
"JoinTheCityPreferences"
,
Context
.
MODE_PRIVATE
);
mLoginButton
=
(
Button
)
findViewById
(
R
.
id
.
login_button
);
mLoginButton
=
(
ImageView
)
findViewById
(
R
.
id
.
login_button
);
mUsername
=
(
EditText
)
findViewById
(
R
.
id
.
username
);
mUsername
=
(
EditText
)
findViewById
(
R
.
id
.
username
);
mPassword
=
(
EditText
)
findViewById
(
R
.
id
.
password
);
mPassword
=
(
EditText
)
findViewById
(
R
.
id
.
password
);
mPassword
.
setOnEditorActionListener
(
new
TextView
.
OnEditorActionListener
()
{
mPassword
.
setOnEditorActionListener
(
new
TextView
.
OnEditorActionListener
()
{
...
...
JoinTheCityAPP/app/src/main/java/anotherlineofcode/com/jointhecityapp/MainActivity.java
View file @
5622d05e
package
anotherlineofcode
.
com
.
jointhecityapp
;
package
anotherlineofcode
.
com
.
jointhecityapp
;
import
android.app.FragmentTransaction
;
import
android.content.Context
;
import
android.content.Context
;
import
android.content.Intent
;
import
android.content.Intent
;
import
android.content.SharedPreferences
;
import
android.content.SharedPreferences
;
import
android.support.v4.app.Fragment
;
import
android.support.v7.app.AppCompatActivity
;
import
android.os.Bundle
;
import
android.os.Bundle
;
import
android.support.design.widget.FloatingActionButton
;
import
android.support.v7.app.AppCompatActivity
;
import
android.support.v7.widget.GridLayoutManager
;
import
android.support.v7.widget.GridLayoutManager
;
import
android.support.v7.widget.RecyclerView
;
import
android.support.v7.widget.RecyclerView
;
import
android.util.Log
;
import
android.view.Menu
;
import
android.view.Menu
;
import
android.view.MenuItem
;
import
android.view.MenuItem
;
import
android.view.View
;
import
com.loopj.android.http.AsyncHttpClient
;
import
com.loopj.android.http.AsyncHttpResponseHandler
;
import
com.nostra13.universalimageloader.cache.memory.impl.WeakMemoryCache
;
import
com.nostra13.universalimageloader.core.DisplayImageOptions
;
import
com.nostra13.universalimageloader.core.ImageLoader
;
import
com.nostra13.universalimageloader.core.ImageLoaderConfiguration
;
import
com.google.android.gms.maps.MapFragment
;
import
org.json.JSONException
;
import
org.json.JSONObject
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.List
;
import
cz.msebera.android.httpclient.Header
;
public
class
MainActivity
extends
AppCompatActivity
{
public
class
MainActivity
extends
AppCompatActivity
{
public
final
static
int
LOGIN_REQUEST
=
1
;
public
final
static
int
LOGIN_REQUEST
=
1
;
private
MapFragment
mMapFragment
;
private
SharedPreferences
sharedPreferences
;
private
SharedPreferences
sharedPreferences
;
private
Context
context
=
this
;
private
GridLayoutManager
lLayout
;
private
AsyncHttpClient
client
;
private
RecyclerView
rView
;
private
RecyclerViewAdapter
rcAdapter
;
@Override
@Override
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
super
.
onCreate
(
savedInstanceState
);
getSupportActionBar
().
setDisplayShowHomeEnabled
(
true
);
getSupportActionBar
().
setLogo
(
R
.
drawable
.
logo_bar
);
getSupportActionBar
().
setDisplayUseLogoEnabled
(
true
);
getSupportActionBar
().
setDisplayShowTitleEnabled
(
false
);
setContentView
(
R
.
layout
.
activity_main
);
setContentView
(
R
.
layout
.
activity_main
);
getSupportActionBar
().
setDisplayShowTitleEnabled
(
false
);
DisplayImageOptions
defaultOptions
=
new
DisplayImageOptions
.
Builder
().
cacheInMemory
(
true
)
.
cacheOnDisc
(
true
).
resetViewBeforeLoading
(
false
).
build
();
ImageLoaderConfiguration
config
=
new
ImageLoaderConfiguration
.
Builder
(
this
.
getApplicationContext
())
.
defaultDisplayImageOptions
(
defaultOptions
)
.
memoryCache
(
new
WeakMemoryCache
())
.
discCacheSize
(
1024
*
1024
).
build
();
ImageLoader
.
getInstance
().
init
(
config
);
FloatingActionButton
fab
=
(
FloatingActionButton
)
findViewById
(
R
.
id
.
fab
);
fab
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
public
void
onClick
(
View
view
)
{
Intent
intent
=
new
Intent
(
context
,
AddApiActivity
.
class
);
startActivity
(
intent
);
}
});
sharedPreferences
=
getSharedPreferences
(
"JoinTheCityPreferences"
,
Context
.
MODE_PRIVATE
);
sharedPreferences
=
getSharedPreferences
(
"JoinTheCityPreferences"
,
Context
.
MODE_PRIVATE
);
SharedPreferences
.
Editor
editor
=
sharedPreferences
.
edit
();
SharedPreferences
.
Editor
editor
=
sharedPreferences
.
edit
();
...
@@ -45,43 +79,61 @@ public class MainActivity extends AppCompatActivity {
...
@@ -45,43 +79,61 @@ public class MainActivity extends AppCompatActivity {
startActivityForResult
(
intent
,
LOGIN_REQUEST
);
startActivityForResult
(
intent
,
LOGIN_REQUEST
);
}
}
if
(
savedInstanceState
==
null
)
{
final
GridLayoutManager
lLayout
=
new
GridLayoutManager
(
context
,
2
);
// Add header and main menu fragments
getFragmentManager
().
beginTransaction
().
add
(
R
.
id
.
content
,
new
MainContentFragment
(),
"MainContentFragment"
).
commit
();
}
List
<
ApiObject
>
rowListItem
=
getAllItemList
();
lLayout
=
new
GridLayoutManager
(
MainActivity
.
this
,
4
);
RecyclerView
rView
=
(
RecyclerView
)
findViewById
(
R
.
id
.
recycler_view
);
rView
=
(
RecyclerView
)
findViewById
(
R
.
id
.
recycler_view
);
rView
.
setHasFixedSize
(
true
);
rView
.
setHasFixedSize
(
true
);
rView
.
setLayoutManager
(
lLayout
);
rView
.
setLayoutManager
(
lLayout
);
RecyclerViewAdapter
rcAdapter
=
new
RecyclerViewAdapter
(
MainActivity
.
this
,
rowListItem
);
rView
.
setAdapter
(
rcAdapter
);
}
@Override
protected
void
onResume
()
{
super
.
onResume
();
if
(
rView
!=
null
){
rView
.
invalidate
();
}
Globals
.
usedApi
.
clear
();
getUsedApiList
();
}
}
private
List
<
ApiObject
>
getAllItemList
(){
private
void
getUsedApiList
(){
client
=
new
AsyncHttpClient
();
List
<
ApiObject
>
allItems
=
new
ArrayList
<
ApiObject
>();
client
.
addHeader
(
"Authorization"
,
"Token "
+
sharedPreferences
.
getString
(
"token"
,
""
));
allItems
.
add
(
new
ApiObject
(
"Kina"
,
R
.
drawable
.
cinema512
));
allItems
.
add
(
new
ApiObject
(
"Wypadki drogowe"
,
R
.
drawable
.
invert512
));
client
.
get
(
getString
(
R
.
string
.
api_url
)
+
"api/user_api/"
,
new
AsyncHttpResponseHandler
()
{
allItems
.
add
(
new
ApiObject
(
"Kina"
,
R
.
drawable
.
cinema512
));
allItems
.
add
(
new
ApiObject
(
"Wypadki drogowe"
,
R
.
drawable
.
invert512
));
@Override
allItems
.
add
(
new
ApiObject
(
"Kina"
,
R
.
drawable
.
cinema512
));
public
void
onSuccess
(
int
statusCode
,
Header
[]
headers
,
byte
[]
responseBody
)
{
allItems
.
add
(
new
ApiObject
(
"Wypadki drogowe"
,
R
.
drawable
.
invert512
));
client
=
null
;
allItems
.
add
(
new
ApiObject
(
"Kina"
,
R
.
drawable
.
cinema512
));
allItems
.
add
(
new
ApiObject
(
"Wypadki drogowe"
,
R
.
drawable
.
invert512
));
// Retrieve server response
allItems
.
add
(
new
ApiObject
(
"Kina"
,
R
.
drawable
.
cinema512
));
JSONObject
jsonResponse
=
JSONParser
.
parseObject
(
responseBody
);
allItems
.
add
(
new
ApiObject
(
"Wypadki drogowe"
,
R
.
drawable
.
invert512
));
allItems
.
add
(
new
ApiObject
(
"Kina"
,
R
.
drawable
.
cinema512
));
try
{
allItems
.
add
(
new
ApiObject
(
"Wypadki drogowe"
,
R
.
drawable
.
invert512
));
for
(
int
i
=
0
;
i
<
jsonResponse
.
getInt
(
"count"
);
i
++)
{
allItems
.
add
(
new
ApiObject
(
"Kina"
,
R
.
drawable
.
cinema512
));
JSONObject
api
=
jsonResponse
.
getJSONArray
(
"results"
).
getJSONObject
(
i
).
getJSONObject
(
"api"
);
allItems
.
add
(
new
ApiObject
(
"Wypadki drogowe"
,
R
.
drawable
.
invert512
));
Globals
.
usedApi
.
add
(
new
ApiObject
(
api
.
getInt
(
"id"
),
api
.
getString
(
"name"
),
api
.
getString
(
"description"
),
api
.
getString
(
"icon"
),
api
.
getString
(
"url"
)));
allItems
.
add
(
new
ApiObject
(
"Kina"
,
R
.
drawable
.
cinema512
));
}
allItems
.
add
(
new
ApiObject
(
"Wypadki drogowe"
,
R
.
drawable
.
invert512
));
List
<
ApiObject
>
rowListItem
=
Globals
.
usedApi
;
return
allItems
;
rcAdapter
=
new
RecyclerViewAdapter
(
context
,
rowListItem
);
rView
.
setAdapter
(
rcAdapter
);
}
catch
(
JSONException
e
)
{
e
.
printStackTrace
();
}
}
@Override
public
void
onFailure
(
int
statusCode
,
Header
[]
headers
,
byte
[]
responseBody
,
Throwable
error
)
{
client
=
null
;
}
});
}
}
@Override
@Override
...
@@ -113,17 +165,6 @@ public class MainActivity extends AppCompatActivity {
...
@@ -113,17 +165,6 @@ public class MainActivity extends AppCompatActivity {
// as you specify a parent activity in AndroidManifest.xml.
// as you specify a parent activity in AndroidManifest.xml.
int
id
=
item
.
getItemId
();
int
id
=
item
.
getItemId
();
if
(
id
==
R
.
id
.
map_view
)
{
Intent
intent
=
new
Intent
(
this
,
MapsActivity
.
class
);
startActivity
(
intent
);
return
true
;
}
if
(
id
==
R
.
id
.
friends
)
{
Intent
intent
=
new
Intent
(
this
,
FriendsActivity
.
class
);
startActivity
(
intent
);
return
true
;
}
return
super
.
onOptionsItemSelected
(
item
);
return
super
.
onOptionsItemSelected
(
item
);
}
}
...
...
JoinTheCityAPP/app/src/main/java/anotherlineofcode/com/jointhecityapp/MapsActivity.java
View file @
5622d05e
...
@@ -2,8 +2,10 @@ package anotherlineofcode.com.jointhecityapp;
...
@@ -2,8 +2,10 @@ package anotherlineofcode.com.jointhecityapp;
import
android.content.Context
;
import
android.content.Context
;
import
android.content.SharedPreferences
;
import
android.content.SharedPreferences
;
import
android.graphics.Color
;
import
android.support.v4.app.FragmentActivity
;
import
android.support.v4.app.FragmentActivity
;
import
android.os.Bundle
;
import
android.os.Bundle
;
import
android.util.Log
;
import
com.google.android.gms.maps.CameraUpdateFactory
;
import
com.google.android.gms.maps.CameraUpdateFactory
;
import
com.google.android.gms.maps.GoogleMap
;
import
com.google.android.gms.maps.GoogleMap
;
...
@@ -11,19 +13,41 @@ import com.google.android.gms.maps.OnMapReadyCallback;
...
@@ -11,19 +13,41 @@ import com.google.android.gms.maps.OnMapReadyCallback;
import
com.google.android.gms.maps.SupportMapFragment
;
import
com.google.android.gms.maps.SupportMapFragment
;
import
com.google.android.gms.maps.model.LatLng
;
import
com.google.android.gms.maps.model.LatLng
;
import
com.google.android.gms.maps.model.MarkerOptions
;
import
com.google.android.gms.maps.model.MarkerOptions
;
import
com.loopj.android.http.AsyncHttpClient
;
import
com.loopj.android.http.AsyncHttpResponseHandler
;
import
com.loopj.android.http.JsonHttpResponseHandler
;
import
org.json.JSONArray
;
import
org.json.JSONException
;
import
org.json.JSONObject
;
import
cn.pedant.SweetAlert.SweetAlertDialog
;
import
cz.msebera.android.httpclient.Header
;
public
class
MapsActivity
extends
FragmentActivity
implements
OnMapReadyCallback
{
public
class
MapsActivity
extends
FragmentActivity
implements
OnMapReadyCallback
{
private
GoogleMap
mMap
;
private
GoogleMap
mMap
;
private
SharedPreferences
sharedPreferences
;
private
SharedPreferences
sharedPreferences
;
private
AsyncHttpClient
client
;
private
final
Context
context
=
this
;
private
String
url
;
@Override
@Override
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
super
.
onCreate
(
savedInstanceState
);
setContentView
(
R
.
layout
.
activity_maps
);
setContentView
(
R
.
layout
.
activity_maps
);
sharedPreferences
=
getSharedPreferences
(
"JoinTheCityPreferences"
,
Context
.
MODE_PRIVATE
);
url
=
getIntent
().
getExtras
().
getString
(
"url"
);
Log
.
d
(
"url"
,
url
);
// 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
.
getMapAsync
(
this
);
mapFragment
.
getMapAsync
(
this
);
}
}
...
@@ -41,15 +65,88 @@ public class MapsActivity extends FragmentActivity implements OnMapReadyCallback
...
@@ -41,15 +65,88 @@ public class MapsActivity extends FragmentActivity implements OnMapReadyCallback
public
void
onMapReady
(
GoogleMap
googleMap
)
{
public
void
onMapReady
(
GoogleMap
googleMap
)
{
mMap
=
googleMap
;
mMap
=
googleMap
;
sharedPreferences
=
getSharedPreferences
(
"JoinTheCityPreferences"
,
Context
.
MODE_PRIVATE
);
client
=
new
AsyncHttpClient
();
int
lat
=
sharedPreferences
.
getInt
(
"lat"
,
0
);
client
.
addHeader
(
"Authorization"
,
"Token "
+
sharedPreferences
.
getString
(
"token"
,
""
));
int
lng
=
sharedPreferences
.
getInt
(
"lng"
,
0
);
Log
.
d
(
"URL KURWA"
,
url
+
"?method=object"
);
client
.
get
(
url
+
"?method=object"
,
new
AsyncHttpResponseHandler
()
{
@Override
public
void
onSuccess
(
int
statusCode
,
Header
[]
headers
,
byte
[]
responseBody
)
{
client
=
null
;
displayMarkers
();
}
@Override
public
void
onFailure
(
int
statusCode
,
Header
[]
headers
,
byte
[]
responseBody
,
Throwable
error
)
{
}
});
}
public
void
displayMarkers
(){
client
=
new
AsyncHttpClient
();
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
()
{
@Override
public
void
onSuccess
(
int
statusCode
,
Header
[]
headers
,
JSONArray
response
)
{
super
.
onSuccess
(
statusCode
,
headers
,
response
);
client
=
null
;
pDialog
.
dismiss
();
try
{
Log
.
d
(
"UPRARSED"
,
response
.
toString
());
for
(
int
i
=
0
;
i
<
response
.
length
();
i
++){
Log
.
d
(
"Data"
,
response
.
toString
());
JSONObject
object
=
response
.
getJSONObject
(
i
);
Log
.
d
(
"Object"
,
object
.
toString
());
LatLng
camera
=
new
LatLng
(
object
.
getDouble
(
"latitude"
),
object
.
getDouble
(
"longitude"
));
// Add a marker in Sydney and move the camera
mMap
.
addMarker
(
new
MarkerOptions
().
position
(
camera
).
title
(
object
.
getString
(
"name"
)).
snippet
(
object
.
getString
(
"address"
)));
}
//Move the camera to the user's location and zoom in!
mMap
.
animateCamera
(
CameraUpdateFactory
.
newLatLngZoom
(
new
LatLng
(
50.0646501
,
19.9449799
),
11.0f
));
}
catch
(
JSONException
e
)
{
e
.
printStackTrace
();
}
}
@Override
public
void
onFailure
(
int
statusCode
,
Header
[]
headers
,
String
responseString
,
Throwable
throwable
)
{
super
.
onFailure
(
statusCode
,
headers
,
responseString
,
throwable
);
client
=
null
;
pDialog
.
dismiss
();
// Display error dialog
new
SweetAlertDialog
(
context
,
SweetAlertDialog
.
ERROR_TYPE
)
.
setTitleText
(
"Błąd"
)
.
setContentText
(
responseString
)
.
show
();
Log
.
e
(
"ERROR"
,
responseString
);
}
LatLng
camera
=
new
LatLng
(
lat
,
lng
);
// // Add a marker in Sydney and move the camera
});
// LatLng sydney = new LatLng(lat, lng);
// mMap.addMarker(new MarkerOptions().position(sydney).title("Marker in Sydney"));
mMap
.
moveCamera
(
CameraUpdateFactory
.
newLatLng
(
camera
));
}
}
}
}
JoinTheCityAPP/app/src/main/java/anotherlineofcode/com/jointhecityapp/RecyclerViewAdapter.java
View file @
5622d05e
...
@@ -7,6 +7,9 @@ import android.view.LayoutInflater;
...
@@ -7,6 +7,9 @@ import android.view.LayoutInflater;
import
android.view.View
;
import
android.view.View
;
import
android.view.ViewGroup
;
import
android.view.ViewGroup
;
import
com.nostra13.universalimageloader.core.ImageLoader
;
import
java.util.List
;
import
java.util.List
;
public
class
RecyclerViewAdapter
extends
RecyclerView
.
Adapter
<
RecyclerViewHolders
>
{
public
class
RecyclerViewAdapter
extends
RecyclerView
.
Adapter
<
RecyclerViewHolders
>
{
...
@@ -30,7 +33,7 @@ public class RecyclerViewAdapter extends RecyclerView.Adapter<RecyclerViewHolder
...
@@ -30,7 +33,7 @@ public class RecyclerViewAdapter extends RecyclerView.Adapter<RecyclerViewHolder
@Override
@Override
public
void
onBindViewHolder
(
RecyclerViewHolders
holder
,
int
position
)
{
public
void
onBindViewHolder
(
RecyclerViewHolders
holder
,
int
position
)
{
holder
.
countryName
.
setText
(
itemList
.
get
(
position
).
getName
());
holder
.
countryName
.
setText
(
itemList
.
get
(
position
).
getName
());
holder
.
countryPhoto
.
setImageResource
(
itemList
.
get
(
position
).
getPhoto
()
);
ImageLoader
.
getInstance
().
displayImage
(
itemList
.
get
(
position
).
getImageUrl
(),
holder
.
countryPhoto
);
}
}
@Override
@Override
...
...
JoinTheCityAPP/app/src/main/java/anotherlineofcode/com/jointhecityapp/RecyclerViewHolders.java
View file @
5622d05e
package
anotherlineofcode
.
com
.
jointhecityapp
;
package
anotherlineofcode
.
com
.
jointhecityapp
;
import
android.content.Context
;
import
android.content.Intent
;
import
android.support.v7.widget.RecyclerView
;
import
android.support.v7.widget.RecyclerView
;
import
android.util.Log
;
import
android.view.View
;
import
android.view.View
;
import
android.widget.ImageView
;
import
android.widget.ImageView
;
import
android.widget.TextView
;
import
android.widget.TextView
;
...
@@ -10,9 +13,11 @@ public class RecyclerViewHolders extends RecyclerView.ViewHolder implements View
...
@@ -10,9 +13,11 @@ public class RecyclerViewHolders extends RecyclerView.ViewHolder implements View
public
TextView
countryName
;
public
TextView
countryName
;
public
ImageView
countryPhoto
;
public
ImageView
countryPhoto
;
private
final
Context
context
;
public
RecyclerViewHolders
(
View
itemView
)
{
public
RecyclerViewHolders
(
View
itemView
)
{
super
(
itemView
);
super
(
itemView
);
context
=
itemView
.
getContext
();
itemView
.
setOnClickListener
(
this
);
itemView
.
setOnClickListener
(
this
);
countryName
=
(
TextView
)
itemView
.
findViewById
(
R
.
id
.
country_name
);
countryName
=
(
TextView
)
itemView
.
findViewById
(
R
.
id
.
country_name
);
countryPhoto
=
(
ImageView
)
itemView
.
findViewById
(
R
.
id
.
country_photo
);
countryPhoto
=
(
ImageView
)
itemView
.
findViewById
(
R
.
id
.
country_photo
);
...
@@ -20,6 +25,9 @@ public class RecyclerViewHolders extends RecyclerView.ViewHolder implements View
...
@@ -20,6 +25,9 @@ public class RecyclerViewHolders extends RecyclerView.ViewHolder implements View
@Override
@Override
public
void
onClick
(
View
view
)
{
public
void
onClick
(
View
view
)
{
Toast
.
makeText
(
view
.
getContext
(),
"Clicked position = "
+
getPosition
(),
Toast
.
LENGTH_SHORT
).
show
();
String
url
=
Globals
.
usedApi
.
get
(
getAdapterPosition
()).
getUrl
();
final
Intent
intent
=
new
Intent
(
context
,
MapsActivity
.
class
);
intent
.
putExtra
(
"url"
,
url
);
context
.
startActivity
(
intent
);
}
}
}
}
JoinTheCityAPP/app/src/main/res/drawable/api_list.png
0 → 100644
View file @
5622d05e
79.7 KB
JoinTheCityAPP/app/src/main/res/drawable/background.png
0 → 100644
View file @
5622d05e
6.06 KB
JoinTheCityAPP/app/src/main/res/drawable/cross.png
0 → 100644
View file @
5622d05e
846 Bytes
JoinTheCityAPP/app/src/main/res/drawable/login.png
0 → 100644
View file @
5622d05e
9.07 KB
JoinTheCityAPP/app/src/main/res/drawable/logo.png
0 → 100644
View file @
5622d05e
37.3 KB
JoinTheCityAPP/app/src/main/res/drawable/logo_bar.png
0 → 100644
View file @
5622d05e
23 KB
JoinTheCityAPP/app/src/main/res/drawable/message.png
0 → 100644
View file @
5622d05e
13.6 KB
JoinTheCityAPP/app/src/main/res/drawable/or.png
0 → 100644
View file @
5622d05e
3.38 KB
JoinTheCityAPP/app/src/main/res/drawable/register.png
0 → 100644
View file @
5622d05e
10.1 KB
JoinTheCityAPP/app/src/main/res/drawable/rounded_focused_input.xml
0 → 100644
View file @
5622d05e
<?xml version="1.0" encoding="utf-8" ?>
<shape
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:thickness=
"0dp"
android:shape=
"rectangle"
>
<solid
android:color=
"#FFFFFF"
/>
<stroke
android:width=
"2dp"
android:color=
"@color/green"
/>
<corners
android:radius=
"30dp"
/>
</shape>
\ No newline at end of file
JoinTheCityAPP/app/src/main/res/drawable/rounded_input.xml
0 → 100644
View file @
5622d05e
<?xml version="1.0" encoding="utf-8"?>
<selector
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
<item
android:state_pressed=
"true"
android:drawable=
"@drawable/rounded_focused_input"
/>
<!-- pressed -->
<item
android:state_focused=
"true"
android:drawable=
"@drawable/rounded_focused_input"
/>
<!-- focused -->
<item
android:drawable=
"@drawable/rounded_unfocused_input"
/>
<!-- default -->
</selector>
\ No newline at end of file
JoinTheCityAPP/app/src/main/res/drawable/rounded_unfocused_input.xml
0 → 100644
View file @
5622d05e
<?xml version="1.0" encoding="utf-8" ?>
<shape
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:thickness=
"0dp"
android:shape=
"rectangle"
>
<solid
android:color=
"#FFFFFF"
/>
<stroke
android:width=
"1dp"
android:color=
"@color/input_border_gray"
/>
<corners
android:radius=
"30dp"
/>
</shape>
\ No newline at end of file
JoinTheCityAPP/app/src/main/res/layout/activity_add_api.xml
0 → 100644
View file @
5622d05e
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:app=
"http://schemas.android.com/apk/res-auto"
xmlns:tools=
"http://schemas.android.com/tools"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:fitsSystemWindows=
"true"
tools:context=
"anotherlineofcode.com.jointhecityapp.AddApiActivity"
>
<android.support.design.widget.AppBarLayout
android:layout_height=
"wrap_content"
android:layout_width=
"match_parent"
android:theme=
"@style/AppBarOverlay"
>
<android.support.v7.widget.Toolbar
android:id=
"@+id/toolbar"
android:layout_width=
"match_parent"
android:layout_height=
"?attr/actionBarSize"
android:background=
"?attr/colorPrimary"
app:popupTheme=
"@style/PopupOverlay"
/>
</android.support.design.widget.AppBarLayout>
<include
layout=
"@layout/content_add_api"
/>
</android.support.design.widget.CoordinatorLayout>
JoinTheCityAPP/app/src/main/res/layout/activity_login_and_registration.xml
View file @
5622d05e
...
@@ -5,22 +5,37 @@
...
@@ -5,22 +5,37 @@
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/background"
tools:context=
"anotherlineofcode.com.jointhecityapp.LoginAndRegistrationActivity"
>
tools:context=
"anotherlineofcode.com.jointhecityapp.LoginAndRegistrationActivity"
>
<ImageView
android:id=
"@+id/logo"
android:src=
"@drawable/logo"
android:layout_width=
"200dp"
android:layout_gravity=
"center_horizontal"
android:layout_height=
"100dp"
android:layout_marginTop=
"10dp"
/>
<EditText
android:id=
"@+id/username"
<EditText
android:id=
"@+id/username"
android:layout_marginTop=
"40dp"
android:layout_width=
"fill_parent"
android:layout_width=
"fill_parent"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:inputType=
"text"
android:inputType=
"text"
android:gravity=
"center"
android:hint=
"Nazwa użytkownika"
android:hint=
"Nazwa użytkownika"
android:maxLines=
"1"
android:maxLines=
"1"
android:singleLine=
"true"
/>
android:singleLine=
"true"
android:paddingLeft=
"20dp"
android:paddingTop=
"10dp"
android:paddingBottom=
"10dp"
android:textColor=
"#696969"
android:ellipsize=
"start"
android:background=
"@drawable/rounded_input"
/>
<EditText
android:id=
"@+id/password"
<EditText
android:id=
"@+id/password"
android:layout_width=
"fill_parent"
android:layout_width=
"fill_parent"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:inputType=
"textPassword"
android:inputType=
"textPassword"
android:gravity=
"center"
android:hint=
"Hasło"
android:hint=
"Hasło"
android:imeActionId=
"@+id/password_ime"
android:imeActionId=
"@+id/password_ime"
android:imeActionLabel=
"@string/action_sign_in"
android:imeActionLabel=
"@string/action_sign_in"
...
@@ -28,14 +43,37 @@
...
@@ -28,14 +43,37 @@
android:maxLines=
"1"
android:maxLines=
"1"
android:singleLine=
"true"
android:singleLine=
"true"
android:layout_marginTop=
"
30dp"
/>
android:layout_marginTop=
"
20dp"
<Button
android:id=
"@+id/login_button"
android:paddingLeft=
"20dp"
android:layout_width=
"fill_parent"
android:paddingTop=
"10dp"
android:layout_height=
"wrap_content"
android:paddingBottom=
"10dp"
android:text=
"Zaloguj"
android:textColor=
"#696969"
android:ellipsize=
"start"
android:background=
"@drawable/rounded_input"
/>
<ImageView
android:id=
"@+id/login_button"
android:layout_width=
"100dp"
android:layout_height=
"50dp"
android:gravity=
"center"
android:gravity=
"center"
android:layout_gravity=
"center_horizontal"
android:src=
"@drawable/login"
android:layout_marginTop=
"50dp"
/>
android:layout_marginTop=
"200dp"
/>
<ImageView
android:layout_marginTop=
"30dp"
android:layout_gravity=
"center_horizontal"
android:layout_width=
"35dp"
android:layout_height=
"20dp"
android:src=
"@drawable/or"
/>
<ImageView
android:id=
"@+id/register_button"
android:layout_width=
"100dp"
android:layout_height=
"50dp"
android:gravity=
"center"
android:layout_gravity=
"center_horizontal"
android:src=
"@drawable/register"
android:layout_marginTop=
"30dp"
/>
</LinearLayout>
</LinearLayout>
JoinTheCityAPP/app/src/main/res/layout/activity_main.xml
View file @
5622d05e
<
Linear
Layout
xmlns:android=
"http://schemas.android.com/apk/res/android"
<
Relative
Layout
xmlns:android=
"http://schemas.android.com/apk/res/android"
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: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"
android:paddingBottom=
"@dimen/activity_vertical_margin"
tools:context=
".MainActivity"
android:
orientation=
"vertical"
tools:context=
".MainActivity
"
>
android:
background=
"@drawable/background
"
>
<android.support.v7.widget.RecyclerView
<android.support.v7.widget.RecyclerView
android:id=
"@+id/recycler_view"
android:id=
"@+id/recycler_view"
...
@@ -12,10 +12,15 @@
...
@@ -12,10 +12,15 @@
android:layout_height=
"match_parent"
android:layout_height=
"match_parent"
android:scrollbars=
"vertical"
/>
android:scrollbars=
"vertical"
/>
<FrameLayout
android:id=
"@+id/content"
<android.support.design.widget.FloatingActionButton
android:id=
"@+id/fab"
android:layout_width=
"fill_parent"
xmlns:app=
"http://schemas.android.com/apk/res-auto"
android:layout_height=
"wrap_content"
>
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:src=
"@drawable/cross"
app:backgroundTint=
"@color/green"
android:layout_marginLeft=
"@dimen/fab_margin"
android:layout_marginRight=
"@dimen/fab_margin"
android:layout_alignParentBottom=
"true"
android:layout_alignParentEnd=
"true"
android:layout_marginBottom=
"@dimen/activity_vertical_margin"
/>
</FrameLayout>
</RelativeLayout>
</LinearLayout>
JoinTheCityAPP/app/src/main/res/layout/api_item.xml
0 → 100644
View file @
5622d05e
<?xml version="1.0" encoding="utf-8"?>
<GridLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:columnCount=
"2"
android:layout_marginTop=
"20dp"
android:paddingRight=
"10dp"
android:paddingLeft=
"10dp"
>
<ImageView
android:id=
"@+id/photo"
android:layout_width=
"50dp"
android:layout_height=
"50dp"
android:layout_rowSpan=
"2"
android:layout_column=
"0"
android:layout_row=
"0"
android:padding=
"5dp"
android:src=
"@drawable/ic_launcher"
/>
<TextView
android:id=
"@+id/name"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_column=
"1"
android:layout_row=
"0"
android:maxLines=
"1"
android:singleLine=
"true"
android:text=
"Name"
/>
<TextView
android:id=
"@+id/description"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_column=
"1"
android:layout_row=
"1"
android:text=
"Description"
/>
<Button
android:id=
"@+id/start"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_column=
"0"
android:layout_columnSpan=
"2"
android:layout_row=
"2"
android:text=
"Zacznij używać"
android:focusable=
"false"
/>
</GridLayout>
\ No newline at end of file
JoinTheCityAPP/app/src/main/res/layout/card_view_list.xml
View file @
5622d05e
...
@@ -15,12 +15,10 @@
...
@@ -15,12 +15,10 @@
<ImageView
<ImageView
android:id=
"@+id/country_photo"
android:id=
"@+id/country_photo"
android:layout_width=
"
5
0dp"
android:layout_width=
"
10
0dp"
android:layout_height=
"
5
0dp"
android:layout_height=
"
10
0dp"
android:layout_centerHorizontal=
"true"
android:layout_centerHorizontal=
"true"
android:padding=
"5dp"
android:padding=
"2dp"
android:contentDescription=
"@string/action_settings"
android:src=
"@drawable/common_google_signin_btn_icon_dark_normal"
android:scaleType=
"centerCrop"
/>
android:scaleType=
"centerCrop"
/>
<TextView
<TextView
...
@@ -28,7 +26,6 @@
...
@@ -28,7 +26,6 @@
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:textSize=
"13sp"
android:textSize=
"13sp"
android:text=
"Description"
android:gravity=
"center"
android:gravity=
"center"
android:layout_below=
"@+id/country_photo"
android:layout_below=
"@+id/country_photo"
android:paddingBottom=
"4dp"
android:paddingBottom=
"4dp"
...
...
JoinTheCityAPP/app/src/main/res/layout/content_add_api.xml
0 → 100644
View file @
5622d05e
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:tools=
"http://schemas.android.com/tools"
xmlns:app=
"http://schemas.android.com/apk/res-auto"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:paddingLeft=
"@dimen/activity_horizontal_margin"
android:paddingRight=
"@dimen/activity_horizontal_margin"
android:paddingTop=
"@dimen/activity_vertical_margin"
android:paddingBottom=
"@dimen/activity_vertical_margin"
app:layout_behavior=
"@string/appbar_scrolling_view_behavior"
tools:showIn=
"@layout/activity_add_api"
tools:context=
"anotherlineofcode.com.jointhecityapp.AddApiActivity"
>
<ListView
android:id=
"@+id/listview_api"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:focusable=
"true"
>
</ListView>
</RelativeLayout>
JoinTheCityAPP/app/src/main/res/menu/menu_main.xml
View file @
5622d05e
...
@@ -4,31 +4,14 @@
...
@@ -4,31 +4,14 @@
<item
<item
android:id=
"@+id/api_list"
android:id=
"@+id/api_list"
android:icon=
"@drawable/
ic_launcher
"
android:icon=
"@drawable/
api_list
"
android:title=
"Lista API"
android:title=
"Lista API"
app:showAsAction=
"always"
/>
app:showAsAction=
"ifRoom"
/>
<item
android:id=
"@+id/friends"
android:icon=
"@drawable/ic_launcher"
android:title=
"Znajomi"
app:showAsAction=
"always"
/>
<item
<item
android:id=
"@+id/messages"
android:id=
"@+id/messages"
android:icon=
"@drawable/
ic_launcher
"
android:icon=
"@drawable/
message
"
android:title=
"Wiadomości"
android:title=
"Wiadomości"
app:showAsAction=
"
always
"
/>
app:showAsAction=
"
ifRoom
"
/>
<item
android:id=
"@+id/map_view"
android:icon=
"@drawable/ic_launcher"
android:title=
"Mapa"
app:showAsAction=
"always"
/>
<item
android:id=
"@+id/logo"
android:icon=
"@drawable/ic_launcher"
android:title=
"Logo"
app:showAsAction=
"always"
/>
</menu>
</menu>
JoinTheCityAPP/app/src/main/res/values/colors.xml
0 → 100644
View file @
5622d05e
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color
name=
"green"
>
#9FC967
</color>
<color
name=
"white"
>
#FFFFFF
</color>
<color
name=
"gray"
>
#F6F6F6
</color>
<color
name=
"input_border_gray"
>
#BABABA
</color>
<color
name=
"text_color_gray"
>
#696969
</color>
</resources>
\ No newline at end of file
JoinTheCityAPP/app/src/main/res/values/strings.xml
View file @
5622d05e
...
@@ -14,4 +14,5 @@
...
@@ -14,4 +14,5 @@
<string
name=
"hello_blank_fragment"
>
Hello blank fragment
</string>
<string
name=
"hello_blank_fragment"
>
Hello blank fragment
</string>
<string
name=
"title_activity_maps"
>
Map
</string>
<string
name=
"title_activity_maps"
>
Map
</string>
<string
name=
"title_activity_friends"
>
FriendsActivity
</string>
<string
name=
"title_activity_friends"
>
FriendsActivity
</string>
<string
name=
"title_activity_add_api"
>
AddApiActivity
</string>
</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