Skip to content
Open
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
95 changes: 86 additions & 9 deletions .idea/other.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 11 additions & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,17 @@
android:enabled="true"
android:exported="false"
android:foregroundServiceType="location" />

<service
android:name=".service.MockerTileService"
android:exported="true"
android:label="@string/mocker_tile_title"
android:icon="@drawable/ic_gps_crosshair"
android:permission="android.permission.BIND_QUICK_SETTINGS_TILE">
<intent-filter>
<action android:name="android.service.quicksettings.action.QS_TILE" />
</intent-filter>
</service>
</application>

</manifest>
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,12 @@ class MockLocationService : Service() {
var isMocking = false
private set

lateinit var latLng: LatLng
var latLng: LatLng = LatLng(0.0, 0.0)
get() = StorageManager.getLatestLocation()
set(value) {
StorageManager.addLocationToHistory(value)
field = value
}

private val locationManager by lazy {
getSystemService(Context.LOCATION_SERVICE) as LocationManager
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package com.lilstiffy.mockgps.service

import android.service.quicksettings.Tile
import android.service.quicksettings.TileService
import com.lilstiffy.mockgps.storage.StorageManager

/**
* Tile service for mocking location
*/
class MockerTileService : TileService() {

override fun onCreate() {
super.onCreate()
StorageManager.initialise(this)
}

override fun onClick() {
super.onClick()
MockLocationService.instance?.let { service ->
service.toggleMocking().also {
if (service.isMocking) {
qsTile.state = Tile.STATE_ACTIVE
qsTile.updateTile()
} else {
qsTile.state = Tile.STATE_INACTIVE
qsTile.updateTile()
}

}
}
}
}
7 changes: 7 additions & 0 deletions app/src/main/res/drawable/ic_gps_crosshair.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:height="24dp" android:viewportHeight="512" android:viewportWidth="512" android:width="24dp">

<path android:fillColor="#FFFFFF" android:pathData="M235,42.9l0,22 -4.7,0.6c-9.6,1.3 -27.8,5.7 -37.3,9.1 -62.9,21.9 -110.2,74.9 -124.3,139.5 -1.4,6.3 -2.8,13.5 -3.2,16.1l-0.6,4.8 -22,-0 -21.9,-0 0,21 0,21 21.9,-0 22,-0 0.6,4.8c1.3,9.5 5.7,27.7 9.1,37.2 21.9,62.9 74.9,110.2 139.5,124.3 6.3,1.4 13.5,2.8 16.2,3.2l4.7,0.6 0,22 0,21.9 21,-0 21,-0 0,-21.9 0,-22 4.8,-0.6c9.6,-1.3 27.7,-5.8 37.4,-9.1 62.8,-21.9 110,-75 124.1,-139.5 1.4,-6.3 2.8,-13.5 3.2,-16.2l0.6,-4.7 22,-0 21.9,-0 0,-21 0,-21 -21.9,-0 -22,-0 -0.6,-4.8c-1.3,-9.6 -5.8,-27.8 -9.2,-37.6 -18.9,-54.8 -63.1,-98.9 -117.9,-117.9 -9.8,-3.4 -28,-7.8 -37.6,-9.2l-4.8,-0.6 0,-22 0,-21.9 -21,-0 -21,-0 0,21.9zM281.2,108.9c71.8,12.4 123.8,74.1 123.8,147.1 0,73.3 -52,134.8 -124.5,147.2 -15.4,2.6 -40.8,2.1 -55.2,-1.1 -53,-11.7 -94.7,-49.2 -111.3,-100.2 -9.3,-28.4 -9.3,-63.4 0,-91.8 15.7,-48 55.4,-85.8 103.1,-98.2 20.6,-5.3 43.9,-6.4 64.1,-3z" android:strokeColor="#00000000"/>

<path android:fillColor="#FFFFFF" android:pathData="M240.1,172.1c-16.7,3.3 -31.7,11.4 -44.2,23.8 -10.2,10.3 -16.7,20.7 -21.1,34.1 -2.6,8.1 -3.1,11.4 -3.5,22.5 -0.6,14.8 0.6,22.2 5.6,35 4.1,10.7 10,19.5 19,28.6 16.8,16.7 36.4,24.9 60.1,24.9 23.7,-0 43.3,-8.2 60.1,-24.9 16.7,-16.8 24.9,-36.4 24.9,-60.1 0,-23.7 -8.2,-43.3 -24.9,-60.1 -12.3,-12.3 -26.4,-20 -43.1,-23.5 -7.1,-1.5 -25.9,-1.7 -32.9,-0.3z" android:strokeColor="#00000000"/>

</vector>
1 change: 1 addition & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<resources>
<string name="app_name">MockGps</string>
<string name="mocker_tile_title">Mock latest</string>
</resources>
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
plugins {
id("com.android.application") version "8.1.4" apply false
id("com.android.application") version "8.5.0" apply false
id("org.jetbrains.kotlin.android") version "1.8.10" apply false
}
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Tue Nov 21 10:19:27 CET 2023
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists