diff options
author | Marcin Zelent <zelent.marcin@gmail.com> | 2018-04-23 17:19:58 +0200 |
---|---|---|
committer | Marcin Zelent <zelent.marcin@gmail.com> | 2018-04-23 17:19:58 +0200 |
commit | e2f49fe23b2ae1a910ab7015167e5ed9a5e4988a (patch) | |
tree | bbc450ed3480593480efcba5a5a58dcd63fa51c1 /app/src/main | |
parent | 2cf7ca569e50caa8d33d4045977d69d1f10771c2 (diff) |
Added proper new observation layout with geolocation and bird choosing,
added swipe refreshing.
Diffstat (limited to 'app/src/main')
13 files changed, 389 insertions, 60 deletions
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 7f947ee..d503607 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -4,6 +4,7 @@ package="org.marcinzelent.liberavem"> <uses-permission android:name="android.permission.INTERNET" /> + <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> <application android:allowBackup="false" @@ -26,12 +27,14 @@ <activity android:name=".SettingsActivity" android:label="@string/title_activity_settings" /> - <activity android:name=".ObservationDetailsActivity" /> + <activity + android:name=".ObservationDetailsActivity" + android:label="@string/observation_details"/> <activity android:name=".NewObservationActivity" android:label="@string/title_activity_new_observation" - android:theme="@style/AppTheme.NoActionBar" /> - <activity android:name=".BirdPickerActivity"></activity> + android:theme="@style/AppTheme" /> + <activity android:name=".BirdPickerActivity" /> </application> </manifest>
\ No newline at end of file diff --git a/app/src/main/java/org/marcinzelent/liberavem/AllObservationsFragment.java b/app/src/main/java/org/marcinzelent/liberavem/AllObservationsFragment.java index a16e833..af4331a 100644 --- a/app/src/main/java/org/marcinzelent/liberavem/AllObservationsFragment.java +++ b/app/src/main/java/org/marcinzelent/liberavem/AllObservationsFragment.java @@ -4,6 +4,7 @@ package org.marcinzelent.liberavem; import android.content.Intent; import android.os.Bundle; import android.support.v4.app.Fragment; +import android.support.v4.widget.SwipeRefreshLayout; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; @@ -48,6 +49,17 @@ public class AllObservationsFragment extends Fragment { @Override public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { + final SwipeRefreshLayout sfl = view.findViewById(R.id.swiperefresh); + sfl.setOnRefreshListener( + new SwipeRefreshLayout.OnRefreshListener() { + @Override + public void onRefresh() { + DataKeeper.getInstance().downloadData(getActivity()); + sfl.setRefreshing(false); + } + } + ); + DataKeeper.getInstance().downloadData(getActivity()); } diff --git a/app/src/main/java/org/marcinzelent/liberavem/BirdsListAdapter.java b/app/src/main/java/org/marcinzelent/liberavem/BirdsListAdapter.java new file mode 100644 index 0000000..68896c0 --- /dev/null +++ b/app/src/main/java/org/marcinzelent/liberavem/BirdsListAdapter.java @@ -0,0 +1,63 @@ +package org.marcinzelent.liberavem; + +import android.content.Context; +import android.support.annotation.NonNull; +import android.support.annotation.Nullable; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.ArrayAdapter; +import android.widget.ImageView; +import android.widget.TextView; + +import com.squareup.picasso.Picasso; + + +public class BirdsListAdapter extends ArrayAdapter<String> { + + private final Bird[] birds; + private Context mContext; + + public BirdsListAdapter(Context context, Bird[] birds){ + super(context, R.layout.observations_list_item); + this.mContext = context; + this.birds = birds; + } + + @Override + public View getDropDownView(int position, @Nullable View convertView, @NonNull ViewGroup parent) { + return getView(position, convertView, parent); + } + + @Override + public int getCount() { + return birds.length; + } + + @NonNull + @Override + public View getView(int position, @Nullable View convertView, @NonNull ViewGroup parent) { + ViewHolder mViewHolder = new ViewHolder(); + + if (convertView == null) { + LayoutInflater mInflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE); + convertView = mInflater.inflate(R.layout.birds_list_item, parent, false); + mViewHolder.name = convertView.findViewById(R.id.bli_name); + mViewHolder.photo = convertView.findViewById(R.id.bli_photo); + convertView.setTag(mViewHolder); + } else { + mViewHolder = (ViewHolder) convertView.getTag(); + } + + mViewHolder.name.setText(birds[position].getNameEnglish()); + Picasso.get().load(birds[position].getPhotoUrl()).into(mViewHolder.photo); + + return convertView; + } + + private static class ViewHolder { + TextView name; + ImageView photo; + } + +}
\ No newline at end of file diff --git a/app/src/main/java/org/marcinzelent/liberavem/DataKeeper.java b/app/src/main/java/org/marcinzelent/liberavem/DataKeeper.java index 27f9dc4..2000eab 100644 --- a/app/src/main/java/org/marcinzelent/liberavem/DataKeeper.java +++ b/app/src/main/java/org/marcinzelent/liberavem/DataKeeper.java @@ -1,9 +1,6 @@ package org.marcinzelent.liberavem; import android.app.Activity; -import android.support.v4.app.Fragment; -import android.support.v4.app.FragmentManager; -import android.view.View; import android.widget.Toast; import com.android.volley.Request; @@ -103,7 +100,7 @@ public class DataKeeper { private void callPopulator(Activity activity) { if (birds != null && observations != null) { - MyObservationsFragment mo = (MyObservationsFragment) ((MainActivity)activity).getAllFragments().get(0); + MyObservationsFragment mo = (MyObservationsFragment) ((MainActivity)activity).getObservationFragments().get(0); List<Observation> myObservationsList = new ArrayList<>(); for (Observation o : observations) if (o.getUserId().equals("Sminem")) myObservationsList.add(o); @@ -111,7 +108,7 @@ public class DataKeeper { Observation[] myObservations = new Observation[myObservationsList.size()]; myObservations = myObservationsList.toArray(myObservations); mo.populateList(myObservations, birds); - AllObservationsFragment aof = (AllObservationsFragment) ((MainActivity)activity).getAllFragments().get(1); + AllObservationsFragment aof = (AllObservationsFragment) ((MainActivity)activity).getObservationFragments().get(1); aof.populateList(observations, birds); } } diff --git a/app/src/main/java/org/marcinzelent/liberavem/MainActivity.java b/app/src/main/java/org/marcinzelent/liberavem/MainActivity.java index 7a17e94..4009f8c 100644 --- a/app/src/main/java/org/marcinzelent/liberavem/MainActivity.java +++ b/app/src/main/java/org/marcinzelent/liberavem/MainActivity.java @@ -9,6 +9,7 @@ import android.support.design.widget.Snackbar; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentManager; import android.support.v4.app.FragmentTransaction; +import android.support.v4.widget.SwipeRefreshLayout; import android.view.View; import android.support.design.widget.NavigationView; import android.support.v4.view.GravityCompat; @@ -139,7 +140,7 @@ public class MainActivity extends AppCompatActivity } - public List<Fragment> getAllFragments() { + public List<Fragment> getObservationFragments() { return observationsFragment.getChildFragmentManager().getFragments(); } } diff --git a/app/src/main/java/org/marcinzelent/liberavem/MyObservationsFragment.java b/app/src/main/java/org/marcinzelent/liberavem/MyObservationsFragment.java index d0ad649..b83d7b4 100644 --- a/app/src/main/java/org/marcinzelent/liberavem/MyObservationsFragment.java +++ b/app/src/main/java/org/marcinzelent/liberavem/MyObservationsFragment.java @@ -4,6 +4,7 @@ package org.marcinzelent.liberavem; import android.content.Intent; import android.os.Bundle; import android.support.v4.app.Fragment; +import android.support.v4.widget.SwipeRefreshLayout; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; @@ -33,6 +34,20 @@ public class MyObservationsFragment extends Fragment { return rootView; } + @Override + public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { + final SwipeRefreshLayout sfl = view.findViewById(R.id.swiperefresh); + sfl.setOnRefreshListener( + new SwipeRefreshLayout.OnRefreshListener() { + @Override + public void onRefresh() { + DataKeeper.getInstance().downloadData(getActivity()); + sfl.setRefreshing(false); + } + } + ); + } + public void populateList(final Observation[] observations, final Bird[] birds) { final ListView observationsListView = getView().findViewById(R.id.observations_list_view); diff --git a/app/src/main/java/org/marcinzelent/liberavem/NewObservationActivity.java b/app/src/main/java/org/marcinzelent/liberavem/NewObservationActivity.java index cf1cf18..e69eaba 100644 --- a/app/src/main/java/org/marcinzelent/liberavem/NewObservationActivity.java +++ b/app/src/main/java/org/marcinzelent/liberavem/NewObservationActivity.java @@ -1,14 +1,22 @@ package org.marcinzelent.liberavem; -import android.app.Activity; +import android.Manifest; +import android.content.Context; +import android.content.pm.PackageManager; +import android.location.Location; +import android.location.LocationListener; +import android.location.LocationManager; import android.os.Bundle; -import android.support.design.widget.FloatingActionButton; -import android.support.design.widget.Snackbar; +import android.provider.ContactsContract; +import android.support.v4.app.ActivityCompat; 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.ArrayAdapter; import android.widget.Button; +import android.widget.EditText; +import android.widget.Spinner; import android.widget.Toast; import com.android.volley.AuthFailureError; @@ -25,40 +33,104 @@ import org.json.JSONException; import org.json.JSONObject; import java.io.UnsupportedEncodingException; -import java.util.HashMap; -import java.util.Map; +import java.util.Calendar; public class NewObservationActivity extends AppCompatActivity { + private Bird selectedBird; + @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_new_observation); - Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); - setSupportActionBar(toolbar); + getSupportActionBar().setDisplayHomeAsUpEnabled(true); + + Button cancelButton = findViewById(R.id.new_cancel); + cancelButton.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + finish(); + } + }); - Button button = findViewById(R.id.button); + Button button = findViewById(R.id.new_add); button.setOnClickListener(new Button.OnClickListener() { public void onClick(View view) { postNewObservation(); } }); + + Spinner newBirdSpinner = findViewById(R.id.new_birds); + BirdsListAdapter adapter = new BirdsListAdapter(this, DataKeeper.getInstance().getBirds()); + newBirdSpinner.setAdapter(adapter); + newBirdSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { + @Override + public void onItemSelected(AdapterView<?> adapterView, View view, int i, long l) { + selectedBird = DataKeeper.getInstance().getBirds()[i]; + } + + @Override + public void onNothingSelected(AdapterView<?> adapterView) { + + } + }); + + // Acquire a reference to the system Location Manager + LocationManager locationManager = (LocationManager) this.getSystemService(Context.LOCATION_SERVICE); + + // Define a listener that responds to location updates + LocationListener locationListener = new LocationListener() { + public void onLocationChanged(Location location) { + // Called when a new location is found by the network location provider. + ((EditText)findViewById(R.id.new_longitude)).setText(String.valueOf(location.getLongitude())); + ((EditText)findViewById(R.id.new_latitude)).setText(String.valueOf(location.getLatitude())); + } + + public void onStatusChanged(String provider, int status, Bundle extras) { + } + + public void onProviderEnabled(String provider) { + } + + public void onProviderDisabled(String provider) { + } + }; + + // Register the listener with the Location Manager to receive location updates + if (ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED + && ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) { + // TODO: Consider calling + // ActivityCompat#requestPermissions + // here to request the missing permissions, and then overriding + // public void onRequestPermissionsResult(int requestCode, String[] permissions, + // int[] grantResults) + // to handle the case where the user grants the permission. See the documentation + // for ActivityCompat#requestPermissions for more details. + return; + } + locationManager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 0, 0, locationListener); + } + + @Override + public boolean onSupportNavigateUp(){ + finish(); + return true; } public void postNewObservation() { try { JSONObject jsonBody = new JSONObject(); - jsonBody.put("BirdId", "51"); - jsonBody.put("Comment", "Værsgo, my friend"); - jsonBody.put("Created", "/Date(1524182400000+0000)/"); - jsonBody.put("Id", "162"); - jsonBody.put("Latitude", "30.1187718"); - jsonBody.put("Longitude", "51.381484"); - jsonBody.put("Placename", "Black lodge"); - jsonBody.put("Population", "5"); + jsonBody.put("BirdId", selectedBird.getId()); + jsonBody.put("Comment", ((EditText)findViewById(R.id.new_comment)).getText()); + jsonBody.put("Created", "/Date(" + System.currentTimeMillis() + "+0000)/"); + jsonBody.put("Id", "0"); + jsonBody.put("Latitude", ((EditText)findViewById(R.id.new_latitude)).getText()); + jsonBody.put("Longitude", ((EditText)findViewById(R.id.new_longitude)).getText()); + jsonBody.put("Placename", ((EditText)findViewById(R.id.new_place)).getText()); + jsonBody.put("Population", ((EditText)findViewById(R.id.new_population)).getText()); jsonBody.put("UserId", "Sminem"); - jsonBody.put("NameDanish", "gråkrage"); - jsonBody.put("NameEnglish", "hooded crow"); + jsonBody.put("NameDanish", selectedBird.getNameDanish()); + jsonBody.put("NameEnglish", selectedBird.getNameEnglish()); final String requestBody = jsonBody.toString(); String url = "http://birdobservationservice.azurewebsites.net/Service1.svc/observations"; @@ -66,13 +138,15 @@ public class NewObservationActivity extends AppCompatActivity { new Response.Listener<String>() { @Override public void onResponse(String response) { - Toast.makeText(getBaseContext(), "Couldn't add observation to the database!", Toast.LENGTH_LONG).show(); + Toast.makeText(getBaseContext(), "Successfully added activity to the database!", Toast.LENGTH_LONG).show(); + NewObservationActivity.this.finish(); + DataKeeper.getInstance().downloadData(NewObservationActivity.this); } }, new Response.ErrorListener() { @Override public void onErrorResponse(VolleyError error) { - Toast.makeText(getBaseContext(), "Successfully added activity to the database!", Toast.LENGTH_LONG).show(); + Toast.makeText(getBaseContext(), "Couldn't add observation to the database!", Toast.LENGTH_LONG).show(); } }) { diff --git a/app/src/main/java/org/marcinzelent/liberavem/ObservationDetailsActivity.java b/app/src/main/java/org/marcinzelent/liberavem/ObservationDetailsActivity.java index 83e9c9a..373fda6 100644 --- a/app/src/main/java/org/marcinzelent/liberavem/ObservationDetailsActivity.java +++ b/app/src/main/java/org/marcinzelent/liberavem/ObservationDetailsActivity.java @@ -3,6 +3,7 @@ package org.marcinzelent.liberavem; import android.content.Intent; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; +import android.support.v7.widget.Toolbar; import android.widget.TextView; import com.squareup.picasso.Picasso; @@ -13,6 +14,7 @@ public class ObservationDetailsActivity extends AppCompatActivity { protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_observation_details); + getSupportActionBar().setDisplayHomeAsUpEnabled(true); Intent intent = getIntent(); Observation observation = (Observation) intent.getSerializableExtra("Observation"); @@ -37,4 +39,10 @@ public class ObservationDetailsActivity extends AppCompatActivity { TextView detailsComment = findViewById(R.id.details_comment); if(observation.getComment() != null) detailsComment.setText(observation.getComment()); } + + @Override + public boolean onSupportNavigateUp(){ + finish(); + return true; + } } diff --git a/app/src/main/res/layout/activity_new_observation.xml b/app/src/main/res/layout/activity_new_observation.xml index 1160131..0f3b10f 100644 --- a/app/src/main/res/layout/activity_new_observation.xml +++ b/app/src/main/res/layout/activity_new_observation.xml @@ -6,14 +6,139 @@ android:layout_height="match_parent" tools:context=".NewObservationActivity"> - <Button - android:id="@+id/button" - android:layout_width="wrap_content" + <Spinner + android:id="@+id/new_birds" + android:layout_width="match_parent" + android:layout_height="0dp" + android:layout_marginEnd="16dp" + android:layout_marginLeft="16dp" + android:layout_marginRight="16dp" + android:layout_marginStart="16dp" + android:layout_marginTop="16dp" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent" /> + + <EditText + android:id="@+id/new_population" + android:layout_width="0dp" android:layout_height="wrap_content" - android:layout_marginLeft="8dp" + android:layout_marginEnd="8dp" + android:layout_marginLeft="16dp" + android:layout_marginRight="16dp" android:layout_marginStart="8dp" android:layout_marginTop="8dp" - android:text="Button" + android:ems="10" + android:hint="@string/population" + android:inputType="textPersonName" + app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" - app:layout_constraintTop_toTopOf="parent" /> + app:layout_constraintTop_toBottomOf="@+id/new_birds" /> + + <EditText + android:id="@+id/new_place" + android:layout_width="0dp" + android:layout_height="wrap_content" + android:layout_marginEnd="8dp" + android:layout_marginLeft="16dp" + android:layout_marginRight="16dp" + android:layout_marginStart="8dp" + android:layout_marginTop="8dp" + android:ems="10" + android:hint="@string/place" + android:inputType="textPersonName" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/new_population" /> + + <EditText + android:id="@+id/new_longitude" + android:layout_width="0dp" + android:layout_height="wrap_content" + android:layout_marginEnd="8dp" + android:layout_marginLeft="16dp" + android:layout_marginRight="16dp" + android:layout_marginStart="8dp" + android:layout_marginTop="8dp" + android:ems="10" + android:hint="@string/longitude" + android:inputType="textPersonName" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/new_place" /> + + <EditText + android:id="@+id/new_latitude" + android:layout_width="0dp" + android:layout_height="wrap_content" + android:layout_marginEnd="8dp" + android:layout_marginLeft="16dp" + android:layout_marginRight="16dp" + android:layout_marginStart="8dp" + android:layout_marginTop="8dp" + android:ems="10" + android:hint="@string/latitude" + android:inputType="textPersonName" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/new_longitude" /> + + <EditText + android:id="@+id/new_comment" + android:layout_width="0dp" + android:layout_height="0dp" + android:layout_marginBottom="8dp" + android:layout_marginEnd="8dp" + android:layout_marginLeft="16dp" + android:layout_marginRight="16dp" + android:layout_marginStart="8dp" + android:layout_marginTop="8dp" + android:ems="10" + android:gravity="top" + android:hint="@string/comment" + android:inputType="textMultiLine" + app:layout_constraintBottom_toTopOf="@+id/linearLayout" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/new_latitude" /> + + <LinearLayout + android:id="@+id/linearLayout" + style="?android:attr/buttonBarStyle" + android:layout_width="0dp" + android:layout_height="wrap_content" + android:layout_marginBottom="8dp" + android:layout_marginEnd="8dp" + android:layout_marginLeft="16dp" + android:layout_marginRight="16dp" + android:layout_marginStart="8dp" + android:orientation="horizontal" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintHorizontal_bias="0.0" + app:layout_constraintStart_toStartOf="parent"> + + <Button + android:id="@+id/new_cancel" + style="?android:attr/buttonBarButtonStyle" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:layout_marginEnd="8dp" + android:layout_marginStart="8dp" + android:layout_weight="1" + android:text="@string/cancel" /> + + <Button + android:id="@+id/new_add" + style="?android:attr/buttonBarButtonStyle" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:layout_marginEnd="8dp" + android:layout_marginRight="8dp" + android:layout_weight="1" + android:text="@string/add" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintEnd_toEndOf="parent" /> + </LinearLayout> + </android.support.constraint.ConstraintLayout>
\ No newline at end of file diff --git a/app/src/main/res/layout/activity_observation_details.xml b/app/src/main/res/layout/activity_observation_details.xml index 4372b9a..7d0fd80 100644 --- a/app/src/main/res/layout/activity_observation_details.xml +++ b/app/src/main/res/layout/activity_observation_details.xml @@ -61,7 +61,7 @@ android:layout_height="wrap_content" android:layout_weight="1" android:minLines="1" - android:text="@string/created" + android:text="@string/created2" android:textStyle="bold" /> <TextView @@ -85,7 +85,7 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:ellipsize="none" - android:text="@string/author" + android:text="@string/author2" android:textStyle="bold" /> <TextView @@ -109,7 +109,7 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="1" - android:text="@string/population" + android:text="@string/population2" android:textStyle="bold" /> <TextView @@ -132,7 +132,7 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="1" - android:text="@string/place" + android:text="@string/place2" android:textStyle="bold" /> <TextView @@ -155,7 +155,7 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="1" - android:text="@string/longitude" + android:text="@string/longitude2" android:textStyle="bold" /> <TextView @@ -178,7 +178,7 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="1" - android:text="@string/latitude" + android:text="@string/latitude2" android:textStyle="bold" /> <TextView @@ -201,7 +201,7 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="1" - android:text="@string/comment" + android:text="@string/comment2" android:textStyle="bold" /> <TextView diff --git a/app/src/main/res/layout/birds_list_item.xml b/app/src/main/res/layout/birds_list_item.xml new file mode 100644 index 0000000..7f928ab --- /dev/null +++ b/app/src/main/res/layout/birds_list_item.xml @@ -0,0 +1,26 @@ +<?xml version="1.0" encoding="utf-8"?> +<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:app="http://schemas.android.com/apk/res-auto" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:padding="8dp"> + + <ImageView + android:id="@+id/bli_photo" + app:srcCompat="@drawable/ic_launcher_background" + android:layout_width="40dp" + android:layout_height="40dp" /> + + <TextView + android:id="@+id/bli_name" + android:textSize="20sp" + android:layout_marginTop="6dp" + android:maxLines="1" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_alignParentTop="true" + android:layout_toRightOf="@+id/bli_photo" + android:layout_toEndOf="@+id/bli_photo" + android:layout_marginLeft="12dp" + android:layout_marginStart="12dp" /> +</RelativeLayout>
\ No newline at end of file diff --git a/app/src/main/res/layout/observations_list.xml b/app/src/main/res/layout/observations_list.xml index 8be21a1..9e04484 100644 --- a/app/src/main/res/layout/observations_list.xml +++ b/app/src/main/res/layout/observations_list.xml @@ -1,16 +1,14 @@ <?xml version="1.0" encoding="utf-8"?> -<android.support.constraint.ConstraintLayout +<android.support.v4.widget.SwipeRefreshLayout xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:app="http://schemas.android.com/apk/res-auto" + android:id="@+id/swiperefresh" android:layout_width="match_parent" android:layout_height="match_parent"> + <ListView android:id="@+id/observations_list_view" android:layout_width="match_parent" - android:layout_height="match_parent" - app:layout_constraintBottom_toBottomOf="parent" - app:layout_constraintEnd_toEndOf="parent" - app:layout_constraintStart_toStartOf="parent" - app:layout_constraintTop_toTopOf="parent" /> -</android.support.constraint.ConstraintLayout>
\ No newline at end of file + android:layout_height="match_parent"/> + +</android.support.v4.widget.SwipeRefreshLayout>
\ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 54fe20a..4885413 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -85,15 +85,22 @@ <string name="pref_title_vibrate">Vibrate</string> <!-- TODO: Remove or change this placeholder text --> - <string name="hello_blank_fragment">Hello blank fragment</string> <string name="my_observations">My observations</string> <string name="all_observations">All observations</string> - <string name="created">Created:</string> - <string name="author">Author:</string> - <string name="population">Population:</string> - <string name="place">Place:</string> - <string name="latitude">Latitude:</string> - <string name="longitude">Longitude:</string> - <string name="comment">Comment:</string> - <string name="title_activity_new_observation">NewObservationActivity</string> + <string name="created2">Created:</string> + <string name="author2">Author:</string> + <string name="population2">Population:</string> + <string name="place2">Place:</string> + <string name="longitude2">Longitude:</string> + <string name="latitude2">Latitude:</string> + <string name="comment2">Comment:</string> + <string name="title_activity_new_observation">New observation</string> + <string name="population">Population</string> + <string name="place">Place</string> + <string name="longitude">Longitude</string> + <string name="latitude">Latitude</string> + <string name="comment">Comment</string> + <string name="cancel">Cancel</string> + <string name="add">Add</string> + <string name="observation_details">Observation details</string> </resources> |