Commit 0583da2f authored by Eryk Leniart's avatar Eryk Leniart

last

parent 22fc36b4
...@@ -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">
......
...@@ -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);
} }
}); });
......
...@@ -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)
......
...@@ -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"
......
...@@ -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"
......
...@@ -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
......
...@@ -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"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment