diff --git a/.idea/modules.xml b/.idea/modules.xml index ab718cfef0d2f471c27d32ceab7fe8c628f0d2d7..92af58643bfa89c0f27e1531c072e9833294e9f8 100644 --- a/.idea/modules.xml +++ b/.idea/modules.xml @@ -2,8 +2,9 @@ <project version="4"> <component name="ProjectModuleManager"> <modules> - <module fileurl="file://$PROJECT_DIR$/android.iml" filepath="$PROJECT_DIR$/android.iml" /> + <module fileurl="file://F:\informatika\pbd\fitness\android.iml" filepath="F:\informatika\pbd\fitness\android.iml" /> <module fileurl="file://$PROJECT_DIR$/app/app.iml" filepath="$PROJECT_DIR$/app/app.iml" /> + <module fileurl="file://$PROJECT_DIR$/fitness.iml" filepath="$PROJECT_DIR$/fitness.iml" /> <module fileurl="file://D:\tugas\sem6\pbd\tubes\android\fitness.iml" filepath="D:\tugas\sem6\pbd\tubes\android\fitness.iml" /> </modules> </component> diff --git a/app/build.gradle b/app/build.gradle index a86e27e60a98c4c55022980556826e76a6b9ff6b..de5568d23fa6e1c3876752fa38d93e2a29181822 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -23,6 +23,7 @@ dependencies { implementation 'com.android.support:appcompat-v7:26.1.0' implementation 'com.android.support.constraint:constraint-layout:1.0.2' implementation 'com.android.support:support-v4:26.1.0' + implementation 'com.google.android.gms:play-services-maps:11.8.0' testImplementation 'junit:junit:4.12' androidTestImplementation 'com.android.support.test:runner:1.0.1' androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1' @@ -30,4 +31,8 @@ dependencies { compile 'com.android.support:cardview-v7:26.1.0' compile 'com.android.support:recyclerview-v7:26.1.0' compile 'com.github.bumptech.glide:glide:4.2.0' + compile 'com.google.android.gms:play-services:11.8.0' + compile 'com.readystatesoftware.sqliteasset:sqliteassethelper:2.0.1' + compile 'com.google.code.gson:gson:2.8.1' + compile 'com.mcxiaoke.volley:library:1.0.19' } diff --git a/app/src/debug/res/values/google_maps_api.xml b/app/src/debug/res/values/google_maps_api.xml new file mode 100644 index 0000000000000000000000000000000000000000..3fe8684c154409acb56711953bab31f620b863ca --- /dev/null +++ b/app/src/debug/res/values/google_maps_api.xml @@ -0,0 +1,24 @@ +<resources> + <!-- + TODO: Before you run your application, you need a Google Maps API key. + + To get one, follow this link, follow the directions and press "Create" at the end: + + https://console.developers.google.com/flows/enableapi?apiid=maps_android_backend&keyType=CLIENT_SIDE_ANDROID&r=F9:96:BE:DA:7B:7D:E8:BD:85:35:18:1A:63:C7:54:13:89:E1:B1:B6%3Bcom.example.leo.fitnessdiy + + You can also add your credentials to an existing key, using these values: + + Package name: + F9:96:BE:DA:7B:7D:E8:BD:85:35:18:1A:63:C7:54:13:89:E1:B1:B6 + + SHA-1 certificate fingerprint: + F9:96:BE:DA:7B:7D:E8:BD:85:35:18:1A:63:C7:54:13:89:E1:B1:B6 + + Alternatively, follow the directions here: + https://developers.google.com/maps/documentation/android/start#get-key + + Once you have your key (it starts with "AIza"), replace the "google_maps_key" + string in this file. + --> + <string name="google_maps_key" templateMergeStrategy="preserve" translatable="false">AIzaSyDQgSwqnDdgPhpvmZpaKp1SFJo_tZUF824</string> +</resources> diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index d7e8703990ab8307d0c15a3741d8d1561a25dfad..4979f2c8eb0f0820d62a110f75151ab7dfc6f444 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -3,6 +3,18 @@ package="com.example.leo.fitnessdiy"> <uses-permission android:name="android.permission.INTERNET" /> + <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> + <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> + <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /> + <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> + <uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" /> + + <!-- + The ACCESS_COARSE/FINE_LOCATION permissions are not required to use + Google Maps Android API v2, but you must specify either coarse or fine + location permissions for the 'MyLocation' functionality. + --> + <uses-feature android:name="android.hardware.location.gps" /> <application android:allowBackup="true" @@ -24,7 +36,22 @@ <activity android:name=".HomeActivity" /> <activity android:name=".PlankActivity" /> <activity android:name=".LevelActivity" /> - <activity android:name=".ExerciseActivity"></activity> + <activity android:name=".ExerciseActivity" /> + <!-- + The API key for Google Maps-based APIs is defined as a string resource. + (See the file "res/values/google_maps_api.xml"). + Note that the API key is linked to the encryption key used to sign the APK. + You need a different API key for each encryption key, including the release key that is used to + sign the APK for publishing. + You can define the keys for the debug and release targets in src/debug/ and src/release/. + --> + <meta-data + android:name="com.google.android.geo.API_KEY" + android:value="@string/google_maps_key" /> + + <activity + android:name=".JoggingActivity" + android:label="@string/title_activity_jogging"></activity> </application> </manifest> \ No newline at end of file diff --git a/app/src/main/java/com/example/leo/fitnessdiy/HomeActivity.java b/app/src/main/java/com/example/leo/fitnessdiy/HomeActivity.java index 11bedcf53226f31e3f73e2321a2c8f512e650919..aa7674eaa492968ce114787c19398fa74ab3da62 100644 --- a/app/src/main/java/com/example/leo/fitnessdiy/HomeActivity.java +++ b/app/src/main/java/com/example/leo/fitnessdiy/HomeActivity.java @@ -54,4 +54,8 @@ public class HomeActivity extends AppCompatActivity } } + public void openJogging(View view) { + Intent i = new Intent(getApplicationContext(), JoggingActivity.class); + startActivity(i); + } } diff --git a/app/src/main/java/com/example/leo/fitnessdiy/JoggingActivity.java b/app/src/main/java/com/example/leo/fitnessdiy/JoggingActivity.java new file mode 100644 index 0000000000000000000000000000000000000000..6bf4f5cfd3e1a6cee83fa67e94487161b3f7ec80 --- /dev/null +++ b/app/src/main/java/com/example/leo/fitnessdiy/JoggingActivity.java @@ -0,0 +1,449 @@ +package com.example.leo.fitnessdiy; + +import android.Manifest; +import android.app.AlertDialog; +import android.content.Context; +import android.content.DialogInterface; +import android.content.pm.PackageManager; +import android.graphics.Color; +import android.location.Address; +import android.location.Geocoder; +import android.location.Location; +import android.location.LocationManager; +import android.os.Build; +import android.support.annotation.NonNull; +import android.support.annotation.Nullable; +import android.support.v4.app.ActivityCompat; +import android.support.v4.app.FragmentActivity; +import android.os.Bundle; +import android.support.v4.content.ContextCompat; +import android.util.Log; +import android.view.Menu; +import android.view.MenuItem; +import android.view.View; +import android.widget.Button; +import android.widget.FrameLayout; +import android.widget.TextView; +import android.widget.Toast; + +import com.google.android.gms.common.ConnectionResult; +import com.google.android.gms.common.api.GoogleApiClient; +import com.google.android.gms.location.FusedLocationProviderClient; +import com.google.android.gms.location.LocationListener; +import com.google.android.gms.location.LocationRequest; +import com.google.android.gms.location.LocationServices; +import com.google.android.gms.location.places.GeoDataClient; +import com.google.android.gms.location.places.PlaceDetectionClient; +import com.google.android.gms.location.places.PlaceLikelihood; +import com.google.android.gms.location.places.PlaceLikelihoodBufferResponse; +import com.google.android.gms.location.places.Places; +import com.google.android.gms.maps.CameraUpdateFactory; +import com.google.android.gms.maps.GoogleMap; +import com.google.android.gms.maps.OnMapReadyCallback; +import com.google.android.gms.maps.SupportMapFragment; +import com.google.android.gms.maps.model.BitmapDescriptorFactory; +import com.google.android.gms.maps.model.CameraPosition; +import com.google.android.gms.maps.model.LatLng; +import com.google.android.gms.maps.model.Marker; +import com.google.android.gms.maps.model.MarkerOptions; +import com.google.android.gms.tasks.OnCompleteListener; +import com.google.android.gms.tasks.Task; + +import org.json.JSONArray; +import org.json.JSONException; +import org.json.JSONObject; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.Locale; + +public class JoggingActivity extends FragmentActivity implements OnMapReadyCallback, + GoogleApiClient.ConnectionCallbacks, + GoogleApiClient.OnConnectionFailedListener, + LocationListener{ + private static final String TAG = JoggingActivity.class.getSimpleName(); + private GoogleMap mMap; + private CameraPosition mCameraPosition; + + // The entry points to the Places API. + private GeoDataClient mGeoDataClient; + private PlaceDetectionClient mPlaceDetectionClient; + + // The entry point to the Fused Location Provider. + private FusedLocationProviderClient mFusedLocationProviderClient; + + // A default location (Sydney, Australia) and default zoom to use when location permission is + // not granted. + private final LatLng mDefaultLocation = new LatLng(-33.8523341, 151.2106085); + private static final int DEFAULT_ZOOM = 15; + private static final int PERMISSIONS_REQUEST_ACCESS_FINE_LOCATION = 1; + private boolean mLocationPermissionGranted; + + // The geographical location where the device is currently located. That is, the last-known + // location retrieved by the Fused Location Provider. + private Location mLastKnownLocation; + + // Keys for storing activity state. + private static final String KEY_CAMERA_POSITION = "camera_position"; + private static final String KEY_LOCATION = "location"; + + // Used for selecting the current place. + private static final int M_MAX_ENTRIES = 5; + private String[] mLikelyPlaceNames; + private String[] mLikelyPlaceAddresses; + private String[] mLikelyPlaceAttributions; + private LatLng[] mLikelyPlaceLatLngs; + private TextView infoJogging; + private Button mButton; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + + // save instance state + if (savedInstanceState != null) { + mLastKnownLocation = savedInstanceState.getParcelable(KEY_LOCATION); + mCameraPosition = savedInstanceState.getParcelable(KEY_CAMERA_POSITION); + } + + setContentView(R.layout.activity_jogging); + + mGeoDataClient = Places.getGeoDataClient(this, null); + + mPlaceDetectionClient = Places.getPlaceDetectionClient(this, null); + + mFusedLocationProviderClient = LocationServices.getFusedLocationProviderClient(this); + + // Obtain the SupportMapFragment and get notified when the map is ready to be used. + SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager() + .findFragmentById(R.id.map); + mapFragment.getMapAsync(this); + + infoJogging = (TextView) findViewById(R.id.tv_info); + + mButton = (Button) findViewById(R.id.control_button); + } + + @Override + protected void onSaveInstanceState(Bundle outState) { + if (mMap != null) { + outState.putParcelable(KEY_CAMERA_POSITION, mMap.getCameraPosition()); + outState.putParcelable(KEY_LOCATION, mLastKnownLocation); + super.onSaveInstanceState(outState); + } + } + + /** + * Manipulates the map once available. + * This callback is triggered when the map is ready to be used. + * This is where we can add markers or lines, add listeners or move the camera. In this case, + * we just add a marker near Sydney, Australia. + * If Google Play services is not installed on the device, the user will be prompted to install + * it inside the SupportMapFragment. This method will only be triggered once the user has + * installed Google Play services and returned to the app. + */ + @Override + public void onMapReady(GoogleMap googleMap) { + mMap = googleMap; + + mMap.setInfoWindowAdapter(new GoogleMap.InfoWindowAdapter() { + @Override + public View getInfoWindow(Marker marker) { + return null; + } + + @Override + public View getInfoContents(Marker marker) { + View infoView = getLayoutInflater().inflate(R.layout.custom_info_location, + (FrameLayout) findViewById(R.id.map), false); + + TextView title = ((TextView) infoView.findViewById(R.id.title)); + title.setText(marker.getTitle()); + + TextView snippet = ((TextView) infoView.findViewById(R.id.snippet)); + snippet.setText(marker.getSnippet()); + + return infoView; + } + }); + + getLocationPermission(); + + updateLocationUI(); + + getDeviceLocation(); + } + + private void getLocationPermission() { + if (ContextCompat.checkSelfPermission(this.getApplicationContext(), + Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED) { + mLocationPermissionGranted = true; + } else { + ActivityCompat.requestPermissions(this, + new String[] {Manifest.permission.ACCESS_FINE_LOCATION}, + PERMISSIONS_REQUEST_ACCESS_FINE_LOCATION); + } + } + + private void getDeviceLocation() { + try { + if (mLocationPermissionGranted) { + Task<Location> locationResult = mFusedLocationProviderClient.getLastLocation(); + locationResult.addOnCompleteListener(this, new OnCompleteListener<Location>() { + @Override + public void onComplete(@NonNull Task<Location> task) { + if (task.isSuccessful()) { + mLastKnownLocation = task.getResult(); + LatLng position = new LatLng(mLastKnownLocation.getLatitude(), + mLastKnownLocation.getLongitude()); + mMap.addMarker( + new MarkerOptions().position(position).title("Your Position")); + mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(position, + DEFAULT_ZOOM)); + } else { + Log.d(TAG, "Current Location is null. Using Defaults"); + Log.e(TAG, "Exception: %s", task.getException()); + + mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(mDefaultLocation, + DEFAULT_ZOOM)); + mMap.getUiSettings().setMyLocationButtonEnabled(false); + } + } + }); + } + } catch (SecurityException e) { + e.printStackTrace(); + } + } + + + @Override + public void onConnected(@Nullable Bundle bundle) { + + } + + @Override + public void onConnectionSuspended(int i) { + + } + + @Override + public void onConnectionFailed(@NonNull ConnectionResult connectionResult) { + + } + + @Override + public void onLocationChanged(Location location) { + mMap.clear(); + + MarkerOptions mp = new MarkerOptions(); + + mp.position(new LatLng(location.getLatitude(), location.getLongitude())); + mp.title("Your Position"); + + mMap.addMarker(mp); + mMap.animateCamera(CameraUpdateFactory.newLatLngZoom( + new LatLng(location.getLatitude(), location.getLongitude()), 16 + )); + } + + @Override + public void onPointerCaptureChanged(boolean hasCapture) { + + } + + /** + * Sets up the options menu. + * @param menu The options menu. + * @return Boolean. + */ + @Override + public boolean onCreateOptionsMenu(Menu menu) { + getMenuInflater().inflate(R.menu.current_place_menu, menu); + return true; + } + + /** + * Handles a click on the menu option to get a place. + * @param item The menu item to handle. + * @return Boolean. + */ + @Override + public boolean onOptionsItemSelected(MenuItem item) { + if (item.getItemId() == R.id.option_get_place) { + showCurrentPlace(); + } + return true; + } + + @Override + public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) { + mLocationPermissionGranted = false; + switch (requestCode) { + case PERMISSIONS_REQUEST_ACCESS_FINE_LOCATION: { + if (grantResults.length > 0 && + grantResults[0] == PackageManager.PERMISSION_GRANTED) { + mLocationPermissionGranted = true; + } + } + } + updateLocationUI(); + } + + private void updateLocationUI() { + if (mMap == null) { + return; + } + + try { + if (mLocationPermissionGranted) { + mMap.setMyLocationEnabled(true); + mMap.getUiSettings().setMyLocationButtonEnabled(true); + } else { + mMap.setMyLocationEnabled(false); + mMap.getUiSettings().setMyLocationButtonEnabled(false); + mLastKnownLocation = null; + getLocationPermission(); + } + } catch (SecurityException e){ + e.printStackTrace(); + } + } + + private void showCurrentPlace() { + if (mMap == null) { + return; + } + + if (mLocationPermissionGranted) { + @SuppressWarnings("MissingPermission") final + Task<PlaceLikelihoodBufferResponse> placeResult = mPlaceDetectionClient + .getCurrentPlace(null); + placeResult.addOnCompleteListener( + new OnCompleteListener<PlaceLikelihoodBufferResponse>() { + @Override + public void onComplete(@NonNull Task<PlaceLikelihoodBufferResponse> task) { + if (task.isSuccessful() && task.getResult() != null) { + PlaceLikelihoodBufferResponse likelihoods = task.getResult(); + + int count; + + if (likelihoods.getCount() < M_MAX_ENTRIES) { + count = likelihoods.getCount(); + } else { + count = M_MAX_ENTRIES; + } + + int i = 0; + mLikelyPlaceNames = new String[count]; + mLikelyPlaceAddresses = new String[count]; + mLikelyPlaceAttributions = new String[count]; + mLikelyPlaceLatLngs = new LatLng[count]; + + for (PlaceLikelihood placeLikelihood : likelihoods){ + mLikelyPlaceNames[i] = (String) placeLikelihood.getPlace() + .getName(); + mLikelyPlaceLatLngs[i] = placeLikelihood.getPlace() + .getLatLng(); + mLikelyPlaceAddresses[i] = (String) placeLikelihood.getPlace() + .getAddress(); + mLikelyPlaceAttributions[i] = (String) placeLikelihood.getPlace() + .getAttributions(); + i++; + if (i > count - 1) { + break; + } + } + + likelihoods.release(); + + openPlacesDialog(); + } else { + Log.d(TAG, "Exception: %s", task.getException()); + } + } + } + ); + } else { + Log.i(TAG, "The user did not grant location permission"); + mMap.addMarker(new MarkerOptions().title("Default Position") + .position(mDefaultLocation) + .snippet("No places found, because location permission is disabled.")); + + getLocationPermission(); + } + } + + public void openPlacesDialog() { + DialogInterface.OnClickListener listener = new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialogInterface, int i) { + LatLng markerLatLng = mLikelyPlaceLatLngs[i]; + String markerSnippet = mLikelyPlaceAddresses[i]; + if (mLikelyPlaceAttributions[i] != null) { + markerSnippet = markerSnippet + "\n" + mLikelyPlaceAttributions[i]; + } + + mMap.addMarker(new MarkerOptions().title(mLikelyPlaceNames[i]) + .position(markerLatLng) + .snippet(markerSnippet)); + + mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(markerLatLng, DEFAULT_ZOOM)); + } + }; + + AlertDialog dialog = new AlertDialog.Builder(this) + .setTitle("Choose a place!") + .setItems(mLikelyPlaceNames, listener) + .show(); + } + + public String getCurrentLocation() { + String loc = ""; + + Geocoder geocoder = new Geocoder(this, Locale.getDefault()); + List<Address> addresses = null; + String errorMessage = ""; + try { + addresses = geocoder.getFromLocation(mLastKnownLocation.getLatitude(), + mLastKnownLocation.getLongitude(), 1); + + loc = addresses.get(0).getAddressLine(0); + } catch (IOException e) { + e.printStackTrace(); + } catch (IllegalArgumentException e) { + errorMessage = "using invalid latitude and longitude data"; + + Log.e(TAG, errorMessage + ". " + + "Latitude = " + mLastKnownLocation.getLatitude() + + ", Longitude = " + + mLastKnownLocation.getLongitude(), e); + } + + return loc; + } + public void startJogging(View view) { + infoJogging.setText(getCurrentLocation()); + mButton.setText("STOP"); + mButton.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + stopJogging(view); + } + }); + mButton.setBackgroundColor(Color.parseColor("#FF0000")); + } + + public void stopJogging(View view) { + infoJogging.append("\n" + getCurrentLocation()); + mButton.setText("START"); + mButton.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + startJogging(view); + } + }); + mButton.setBackgroundColor(Color.parseColor("#4CFF00")); + } +} diff --git a/app/src/main/java/com/example/leo/fitnessdiy/model/Jogging.java b/app/src/main/java/com/example/leo/fitnessdiy/model/Jogging.java new file mode 100644 index 0000000000000000000000000000000000000000..cd3fa4c64f4b6a7a1e9d717aa861fc241684a5fe --- /dev/null +++ b/app/src/main/java/com/example/leo/fitnessdiy/model/Jogging.java @@ -0,0 +1,44 @@ +package com.example.leo.fitnessdiy.model; + +/** + * Created by Leo on 19/02/2018. + */ + +public class Jogging { + private String startingPoint; + private String endPoint; + private float distance; + private float duration; + + public String getStartingPoint() { + return startingPoint; + } + + public void setStartingPoint(String startingPoint) { + this.startingPoint = startingPoint; + } + + public String getEndPoint() { + return endPoint; + } + + public void setEndPoint(String endPoint) { + this.endPoint = endPoint; + } + + public float getDistance() { + return distance; + } + + public void setDistance(float distance) { + this.distance = distance; + } + + public float getDuration() { + return duration; + } + + public void setDuration(float duration) { + this.duration = duration; + } +} diff --git a/app/src/main/res/layout/activity_home.xml b/app/src/main/res/layout/activity_home.xml index 47a494b687e61427a45fdde798eca0211f7bf127..50777db35b453185b559dcfe3b825a432302ae45 100644 --- a/app/src/main/res/layout/activity_home.xml +++ b/app/src/main/res/layout/activity_home.xml @@ -13,19 +13,21 @@ android:orientation="horizontal"> <Button android:id="@+id/history_button" - android:layout_width="match_parent" + android:layout_width="wrap_content" android:layout_height="wrap_content" - android:onClick="changeFragment" - android:layout_weight="1" - android:text="@string/history" - /> + android:onClick="openHistory" + android:text="@string/history"/> <Button android:id="@+id/exercise_button" - android:layout_width="match_parent" + android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_weight="1" android:text="@string/exercise" android:onClick="changeFragment"/> + <Button + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="Jogging" + android:onClick="openJogging"/> </LinearLayout> <fragment android:name="com.example.leo.fitnessdiy.ExerciseFragment" diff --git a/app/src/main/res/layout/activity_jogging.xml b/app/src/main/res/layout/activity_jogging.xml new file mode 100644 index 0000000000000000000000000000000000000000..f275aa3f05b99621773e55ce5b8519830a673cf0 --- /dev/null +++ b/app/src/main/res/layout/activity_jogging.xml @@ -0,0 +1,38 @@ +<?xml version="1.0" encoding="utf-8"?> +<FrameLayout xmlns:app="http://schemas.android.com/apk/res-auto" + xmlns:tools="http://schemas.android.com/tools" + xmlns:android="http://schemas.android.com/apk/res/android" + android:layout_width="match_parent" + android:layout_height="match_parent" + tools:context="com.example.leo.fitnessdiy.JoggingActivity"> + + <fragment xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:map="http://schemas.android.com/apk/res-auto" + xmlns:tools="http://schemas.android.com/tools" + android:id="@+id/map" + android:name="com.google.android.gms.maps.SupportMapFragment" + android:layout_width="match_parent" + android:layout_height="match_parent" + tools:context="com.example.leo.fitnessdiy.JoggingActivity" /> + + <TextView + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:id="@+id/tv_info"/> + + <Button + android:id="@+id/control_button" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:padding="12dp" + android:text="@string/start" + android:textSize="24dp" + android:layout_gravity="bottom" + android:layout_marginLeft="16dp" + android:layout_marginRight="16dp" + android:layout_marginBottom="16dp" + android:onClick="startJogging" + android:textColor="#ffffff" + android:background="#4cff00"/> + +</FrameLayout> \ No newline at end of file diff --git a/app/src/main/res/layout/custom_info_location.xml b/app/src/main/res/layout/custom_info_location.xml new file mode 100644 index 0000000000000000000000000000000000000000..ab956cfba846f5be8238db0003ff19cf008aeb9f --- /dev/null +++ b/app/src/main/res/layout/custom_info_location.xml @@ -0,0 +1,20 @@ +<?xml version="1.0" encoding="utf-8"?> +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layoutDirection="locale" + android:orientation="vertical"> + <TextView + android:id="@+id/title" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_gravity="center_horizontal" + android:textColor="#ff000000" + android:textStyle="bold" /> + + <TextView + android:id="@+id/snippet" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:textColor="#ff7f7f7f" /> +</LinearLayout> \ No newline at end of file diff --git a/app/src/main/res/menu/current_place_menu.xml b/app/src/main/res/menu/current_place_menu.xml new file mode 100644 index 0000000000000000000000000000000000000000..cdaaad6d5852e700c9d5930b5523ef7617531e1b --- /dev/null +++ b/app/src/main/res/menu/current_place_menu.xml @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="utf-8"?><!-- + Copyright (C) 2016 The Android Open Source Project + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> +<menu xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:app="http://schemas.android.com/apk/res-auto"> + <item + android:id="@+id/option_get_place" + android:title="Get Place" + app:showAsAction="always"/> +</menu> \ 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 f48c5d9bc069f0452ca7d9404b228ea7d0b2fd33..65e280cc7851616b323694a21bd7866b0ef5c482 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -17,4 +17,6 @@ <!-- TODO: Remove or change this placeholder text --> <string name="hello_blank_fragment">Hello blank fragment</string> + <string name="title_activity_jogging">Map</string> + <string name="start">START</string> </resources> diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml index 0eb88fe3350eaa944c0c6fe7e949e1cab494e8e8..5885930df6d10edf3d6df40d6556297d11f953da 100644 --- a/app/src/main/res/values/styles.xml +++ b/app/src/main/res/values/styles.xml @@ -1,7 +1,7 @@ <resources> <!-- Base application theme. --> - <style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar"> + <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar"> <!-- Customize your theme here. --> <item name="colorPrimary">@color/colorPrimary</item> <item name="colorPrimaryDark">@color/colorPrimaryDark</item> diff --git a/app/src/release/res/values/google_maps_api.xml b/app/src/release/res/values/google_maps_api.xml new file mode 100644 index 0000000000000000000000000000000000000000..1ef79e9f2e292599818e1e59663e66cb62fe2ab5 --- /dev/null +++ b/app/src/release/res/values/google_maps_api.xml @@ -0,0 +1,20 @@ +<resources> + <!-- + TODO: Before you release your application, you need a Google Maps API key. + + To do this, you can either add your release key credentials to your existing + key, or create a new key. + + Note that this file specifies the API key for the release build target. + If you have previously set up a key for the debug target with the debug signing certificate, + you will also need to set up a key for your release certificate. + + Follow the directions here: + + https://developers.google.com/maps/documentation/android/signup + + Once you have your key (it starts with "AIza"), replace the "google_maps_key" + string in this file. + --> + <string name="google_maps_key" templateMergeStrategy="preserve" translatable="false">YOUR_KEY_HERE</string> +</resources> diff --git a/gradle.properties b/gradle.properties index b8a1e028b25c1d2f36efd46349978f03b5ffc69e..c3e97349da2e190824bac094c8dc3dcea37a9495 100644 --- a/gradle.properties +++ b/gradle.properties @@ -13,12 +13,4 @@ # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects # org.gradle.parallel=true #Mon Feb 12 14:53:51 ICT 2018 -systemProp.http.proxyPort=8080 -systemProp.http.proxyUser=rizki_halasan -systemProp.http.proxyPassword=07007831 -org.gradle.jvmargs=-Xmx1536m -systemProp.https.proxyPassword=07007831 -systemProp.https.proxyHost=cache.itb.ac.id -systemProp.http.proxyHost=cache.itb.ac.id -systemProp.https.proxyPort=8080 -systemProp.https.proxyUser=rizki_halasan +