Skip to content
This repository has been archived by the owner on Aug 23, 2023. It is now read-only.

Updates all resources, gradle, and manifest. #226

Merged
merged 1 commit into from
Mar 13, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions LocationUpdatesBackgroundKotlin/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,17 @@ dependencies {
implementation 'androidx.core:core-ktx:1.2.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'androidx.preference:preference:1.1.0'

implementation 'androidx.room:room-runtime:2.2.4'
kapt 'androidx.room:room-compiler:2.2.4'

implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'
implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.2.0'
kapt 'com.android.databinding:compiler:3.1.4'

implementation 'com.google.android.gms:play-services-location:17.0.0'

testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
Expand Down
14 changes: 12 additions & 2 deletions LocationUpdatesBackgroundKotlin/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
xmlns:tools="http://schemas.android.com/tools"
package="com.google.android.gms.location.sample.locationupdatesbackgroundkotlin">

<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION" />

<application
android:allowBackup="true"
Expand All @@ -28,13 +29,22 @@
android:supportsRtl="true"
android:theme="@style/AppTheme"
tools:ignore="AllowBackup,GoogleAppIndexingWarning">
<activity android:name=".MainActivity">

<activity android:name=".ui.MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>

<receiver
android:name=".LocationUpdatesBroadcastReceiver"
android:exported="true">
<intent-filter>
<action android:name="com.google.android.gms.location.sample.locationupdatesbackgroundkotlin.LocationUpdatesBroadcastReceiver.ACTION_PROCESS_UPDATES" />
</intent-filter>
</receiver>
</application>

</manifest>
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright 2020 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.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="#FF008577"
android:pathData="M12,2C8.13,2 5,5.13 5,9c0,5.25 7,13 7,13s7,-7.75 7,-13c0,-3.87 -3.13,-7 -7,-7zM7,9c0,-2.76 2.24,-5 5,-5s5,2.24 5,5c0,2.88 -2.88,7.19 -5,9.88C9.92,16.21 7,11.85 7,9z"/>
<path
android:fillColor="#FF008577"
android:pathData="M12,9m-2.5,0a2.5,2.5 0,1 1,5 0a2.5,2.5 0,1 1,-5 0"/>
</vector>
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright 2020 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.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="#FF008577"
android:pathData="M12,8c-2.21,0 -4,1.79 -4,4s1.79,4 4,4 4,-1.79 4,-4 -1.79,-4 -4,-4zM20.94,11c-0.46,-4.17 -3.77,-7.48 -7.94,-7.94L13,1h-2v2.06C6.83,3.52 3.52,6.83 3.06,11L1,11v2h2.06c0.46,4.17 3.77,7.48 7.94,7.94L11,23h2v-2.06c4.17,-0.46 7.48,-3.77 7.94,-7.94L23,13v-2h-2.06zM12,19c-3.87,0 -7,-3.13 -7,-7s3.13,-7 7,-7 7,3.13 7,7 -3.13,7 -7,7z"/>
</vector>
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
See the License for the specific language governing permissions and
limitations under the License.
-->

<layout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">
Expand All @@ -23,7 +22,7 @@
android:id="@+id/fragment_container"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
tools:context=".ui.MainActivity">
</FrameLayout>

</layout>
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright 2020 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.
-->
<layout
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">

<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".ui.LocationUpdateFragment">

<TextView
android:id="@+id/locationOutputTextView"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_marginStart="@dimen/margin_normal"
android:layout_marginLeft="@dimen/margin_normal"
android:layout_marginTop="@dimen/margin_normal"
android:layout_marginEnd="@dimen/margin_normal"
android:layout_marginRight="@dimen/margin_normal"
android:layout_marginBottom="@dimen/margin_normal"
android:scrollbars="vertical"
android:textIsSelectable="true"
app:layout_constraintBottom_toTopOf="@+id/startOrStopLocationTrackingButton"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.438"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/enableBackgroundLocationButton"
tools:text="Outputs location in intervals" />

<Button
android:id="@+id/startOrStopLocationTrackingButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/margin_normal"
android:layout_marginLeft="@dimen/margin_normal"
android:layout_marginEnd="@dimen/margin_normal"
android:layout_marginRight="@dimen/margin_normal"
android:layout_marginBottom="@dimen/margin_normal"
android:text="@string/start_location_tracking"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" />

<Button
android:id="@+id/enableBackgroundLocationButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/margin_normal"
android:layout_marginEnd="@dimen/margin_normal"
android:layout_marginRight="@dimen/margin_normal"
android:text="@string/enhance_with_background_location_button_text"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />

</androidx.constraintlayout.widget.ConstraintLayout>
</layout>
Original file line number Diff line number Diff line change
Expand Up @@ -24,34 +24,66 @@
android:id="@+id/frameLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".PermissionRequestFragment">
tools:context=".ui.PermissionRequestFragment">

<ImageView
android:id="@+id/iconImageView"
android:layout_width="@dimen/permission_icon_vector_dimension"
android:layout_height="@dimen/permission_icon_vector_dimension"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginStart="@dimen/margin_normal"
android:layout_marginLeft="@dimen/margin_normal"
android:layout_marginTop="@dimen/margin_large"
android:layout_marginEnd="@dimen/margin_normal"
android:layout_marginRight="@dimen/margin_normal"
android:src="@drawable/ic_location_on_24px"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />

<TextView
android:id="@+id/explanationTextView"
android:id="@+id/titleTextView"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_marginStart="16dp"
android:layout_marginLeft="16dp"
android:layout_marginTop="16dp"
android:layout_marginEnd="16dp"
android:layout_marginRight="16dp"
android:layout_marginBottom="16dp"
android:text="@string/fine_location_access_rationale_text"
android:textSize="24sp"
app:layout_constraintBottom_toTopOf="@+id/permissionRequestButton"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/margin_normal"
android:layout_marginLeft="@dimen/margin_normal"
android:layout_marginTop="@dimen/margin_normal"
android:layout_marginEnd="@dimen/margin_normal"
android:layout_marginRight="@dimen/margin_normal"
android:gravity="center_horizontal"
android:text="@string/fine_location_access_rationale_title_text"
android:textSize="@dimen/fragment_permission_title_text_size"
android:textStyle="bold"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
app:layout_constraintTop_toBottomOf="@+id/iconImageView" />

<TextView
android:id="@+id/detailsTextView"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/margin_normal"
android:layout_marginLeft="@dimen/margin_normal"
android:layout_marginTop="@dimen/margin_large"
android:layout_marginEnd="@dimen/margin_normal"
android:layout_marginRight="@dimen/margin_normal"
android:gravity="center_horizontal"
android:text="@string/fine_location_access_rationale_details_text"
android:textSize="@dimen/fragment_permission_body_text_size"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/titleTextView" />

<Button
android:id="@+id/permissionRequestButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginLeft="16dp"
android:layout_marginEnd="16dp"
android:layout_marginRight="16dp"
android:layout_marginBottom="16dp"
android:layout_marginStart="@dimen/margin_normal"
android:layout_marginLeft="@dimen/margin_normal"
android:layout_marginEnd="@dimen/margin_normal"
android:layout_marginRight="@dimen/margin_normal"
android:layout_marginBottom="@dimen/margin_normal"
android:text="@string/enable_fine_location_button_text"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
Expand Down
25 changes: 25 additions & 0 deletions LocationUpdatesBackgroundKotlin/app/src/main/res/values/dimens.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright 2020 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.
-->
<resources>
<dimen name="margin_normal">16dp</dimen>
<dimen name="margin_large">32dp</dimen>

<dimen name="permission_icon_vector_dimension">120dp</dimen>

<dimen name="fragment_permission_title_text_size">24sp</dimen>
<dimen name="fragment_permission_body_text_size">18sp</dimen>
</resources>
52 changes: 41 additions & 11 deletions LocationUpdatesBackgroundKotlin/app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,27 +17,57 @@
<resources>
<string name="app_name">Location Updates via Background</string>

<string name="simple_permission_rationale">Location permission needed for core functionality</string>
<string name="permission_denied_explanation">Permission was denied, but is needed for core functionality.</string>
<string name="fine_location_permission_rationale">The fine location permission is needed for core functionality</string>
<string name="fine_permission_denied_explanation">Fine location permission was denied, but is needed for core functionality.</string>

<string name="background_location_permission_rationale">The background location permission is needed for enhanced functionality</string>
<string name="background_permission_denied_explanation">Background location permission was denied, but is needed for enhanced functionality.</string>


<string name="settings">Settings</string>
<string name="ok">OK</string>

<string name="fine_location_access_rationale_text">Welcome to the Location in Background
Sample.\n\nFor this app to show you your location, you will need to approve the app\'s
access to your location.\n\nPlease do that below.
<string name="fine_location_access_rationale_title_text">Welcome to the Location Sample!</string>

<string name="fine_location_access_rationale_details_text">This sample allows you to track your
location while using the app.
\n\n
In order for this feature to work, please approve access to your location via the button
below.
</string>

<string name="background_location_access_rationale_text">To make the Location in
Background Sample even better and track our location even when the app isn\'t open,
allow us to access your background location. \n\nFor this app to show you your location,
you will need to approve the app\'s access to your location.\n\nPlease do that below.
<string name="background_location_access_rationale_title_text">Improve location accuracy!</string>

<string name="background_location_access_rationale_details_text">You can improve your location
accuracy by tracking your location from the background.
\n\n
That means you don\'t have to keep this wonderful app open all the time to accurately track
your location!
\n\n
To improve the location accuracy, please choose \"Allow all the time\" via the button below.
</string>


<string name="enable_fine_location_button_text">Grant Fine Location</string>
<string name="enable_background_location_button_text">Grant Background Location</string>
<string name="enable_fine_location_button_text">Approve Location Access</string>
<string name="enable_background_location_button_text">Approve Background Location Access</string>

<string name="start_location_tracking">Start Location Tracking</string>
<string name="stop_location_tracking">Stop Location Tracking</string>

<string name="enhance_with_background_location_button_text">Enhance with Background Location</string>


<!-- NEW ones -->
<string name="request_updates">Request updates</string>
<string name="remove_updates">Remove updates</string>
<string name="unknown_location">Unknown location</string>

<string name="batched_location_updates">Batched location updates</string>
<string name="emptyLocationDatabaseMessage">Please start tracking location!</string>

<plurals name="num_locations_reported">
<item quantity="zero">No location reported</item>
<item quantity="one">One location reported</item>
<item quantity="other">%d locations reported</item>
</plurals>
</resources>
2 changes: 1 addition & 1 deletion LocationUpdatesBackgroundKotlin/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ buildscript {

}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.3'
classpath 'com.android.tools.build:gradle:3.6.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Tue Feb 18 08:36:07 PST 2020
#Sun Mar 08 13:43:01 PDT 2020
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-all.zip