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

last

parent 22fc36b4
......@@ -14,7 +14,7 @@
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:icon="@drawable/logo"
android:label="@string/app_name"
android:theme="@style/Theme.AppCompat.Light"
tools:replace="android:icon">
......
......@@ -8,6 +8,7 @@ import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.ListView;
import android.widget.TextView;
import com.nostra13.universalimageloader.core.ImageLoader;
......@@ -21,7 +22,7 @@ public class ApiListAdapter extends ArrayAdapter<ApiObject> {
}
@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
ApiObject api = getItem(position);
// Check if an existing view is being reused, otherwise inflate the view
......@@ -42,7 +43,7 @@ public class ApiListAdapter extends ArrayAdapter<ApiObject> {
startUsing.setOnClickListener(new View.OnClickListener() {
@Override
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
// Obtain the SupportMapFragment and get notified when the map is ready to be used.
SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager()
.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);
}
......@@ -65,6 +65,13 @@ public class MapsActivity extends FragmentActivity implements OnMapReadyCallback
public void onMapReady(GoogleMap 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.addHeader("Authorization", "Token " + sharedPreferences.getString("token", ""));
......@@ -74,13 +81,14 @@ public class MapsActivity extends FragmentActivity implements OnMapReadyCallback
client.get(url + "?method=object", new AsyncHttpResponseHandler() {
@Override
public void onSuccess(int statusCode, Header[] headers, byte[] responseBody) {
pDialog.dismiss();
client = null;
displayMarkers();
}
@Override
public void onFailure(int statusCode, Header[] headers, byte[] responseBody, Throwable error) {
pDialog.dismiss();
}
});
......@@ -92,13 +100,6 @@ public class MapsActivity extends FragmentActivity implements OnMapReadyCallback
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
......@@ -106,8 +107,6 @@ public class MapsActivity extends FragmentActivity implements OnMapReadyCallback
super.onSuccess(statusCode, headers, response);
client = null;
pDialog.dismiss();
try {
Log.d("UPRARSED", response.toString());
......@@ -116,9 +115,15 @@ public class MapsActivity extends FragmentActivity implements OnMapReadyCallback
JSONObject object = response.getJSONObject(i);
Log.d("Object", object.toString());
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
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!
......@@ -133,7 +138,6 @@ public class MapsActivity extends FragmentActivity implements OnMapReadyCallback
super.onFailure(statusCode, headers, responseString, throwable);
client = null;
pDialog.dismiss();
// Display error dialog
new SweetAlertDialog(context, SweetAlertDialog.ERROR_TYPE)
......
......@@ -4,6 +4,7 @@
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"
android:background="@drawable/back"
tools:context="anotherlineofcode.com.jointhecityapp.AddApiActivity">
<android.support.design.widget.AppBarLayout android:layout_height="wrap_content"
......
......@@ -5,6 +5,7 @@
android:paddingTop="@dimen/activity_vertical_margin"
android:paddingBottom="@dimen/activity_vertical_margin"
android:orientation="vertical"
android:background="@drawable/back"
tools:context="anotherlineofcode.com.jointhecityapp.LoginAndRegistrationActivity">
<!--android:background="@drawable/background"-->
<ImageView android:id="@+id/logo"
......
......@@ -3,7 +3,9 @@
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" tools:context=".MainActivity">
android:paddingBottom="@dimen/activity_vertical_margin"
android:background="@drawable/back"
tools:context=".MainActivity">
<!--android:background="@drawable/background">-->
<android.support.v7.widget.RecyclerView
......
......@@ -13,8 +13,7 @@
android:layout_rowSpan="2"
android:layout_column="0"
android:layout_row="0"
android:padding="5dp"
android:src="@drawable/ic_launcher" />
android:padding="5dp" />
<TextView android:id="@+id/name"
android:layout_width="match_parent"
......@@ -22,15 +21,13 @@
android:layout_column="1"
android:layout_row="0"
android:maxLines="1"
android:singleLine="true"
android:text="Name"/>
android:singleLine="true" />
<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"/>
android:layout_row="1" />
<Button android:id="@+id/start"
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