fdroiddata/metadata/net.nurik.roman.dashclock/disable_gplay.diff
أحمد المحمودي (Ahmed El-Mahmoudy) 598fbdf52e Build DashClock with gradle
* Found out that vercode is actually 30 (see main/version.properties)
* Added basename.patch to fix case of archivesBaseName value (dashclock -> DashClock)
2014-01-26 17:27:58 +02:00

190 lines
8.8 KiB
Diff

diff --git a/main/src/main/AndroidManifest.xml b/main/src/main/AndroidManifest.xml
index 307e779..d635d22 100755
diff --git a/main/src/main/java/com/google/android/apps/dashclock/weather/WeatherExtension.java b/main/src/main/java/com/google/android/apps/dashclock/weather/WeatherExtension.java
index b9aec91..5119fa2 100644
diff --git a/main/build.gradle b/main/build.gradle
index 14b8eb7..e04e756 100644
--- a/main/src/main/AndroidManifest.xml
+++ b/main/src/main/AndroidManifest.xml
@@ -283,9 +283,6 @@
<!-- Google Play Services -->
- <meta-data android:name="com.google.android.gms.version"
- android:value="@integer/google_play_services_version" />
-
</application>
</manifest>
--- a/main/src/main/java/com/google/android/apps/dashclock/weather/WeatherExtension.java
+++ b/main/src/main/java/com/google/android/apps/dashclock/weather/WeatherExtension.java
@@ -40,10 +40,6 @@ import com.google.android.apps.dashclock.LogUtils;
import com.google.android.apps.dashclock.api.DashClockExtension;
import com.google.android.apps.dashclock.api.ExtensionData;
import com.google.android.apps.dashclock.configuration.AppChooserPreference;
-import com.google.android.gms.common.ConnectionResult;
-import com.google.android.gms.common.GooglePlayServicesUtil;
-import com.google.android.gms.location.LocationClient;
-import com.google.android.gms.location.LocationRequest;
import net.nurik.roman.dashclock.BuildConfig;
import net.nurik.roman.dashclock.R;
@@ -63,8 +59,6 @@ import static com.google.android.apps.dashclock.weather.YahooWeatherApiClient.Lo
import static com.google.android.apps.dashclock.weather.YahooWeatherApiClient.getLocationInfo;
import static com.google.android.apps.dashclock.weather.YahooWeatherApiClient.getWeatherForLocationInfo;
import static com.google.android.apps.dashclock.weather.YahooWeatherApiClient.setWeatherUnits;
-import static com.google.android.gms.common.GooglePlayServicesClient.ConnectionCallbacks;
-import static com.google.android.gms.common.GooglePlayServicesClient.OnConnectionFailedListener;
/**
* A local weather and forecast extension.
@@ -99,7 +93,6 @@ public class WeatherExtension extends DashClockExtension {
private static final int LOCATION_TIMEOUT_MILLIS = 60 * SECONDS_MILLIS;
private static final Criteria sLocationCriteria;
- private LocationClient mPlayServicesLocationClient;
private static String sWeatherUnits = "f";
private static Intent sWeatherIntent;
@@ -200,96 +193,7 @@ public class WeatherExtension extends DashClockExtension {
private void tryGooglePlayServicesGetLocationAndPublishWeatherUpdate(
final Runnable errorRunnable) {
- int playServicesResult = GooglePlayServicesUtil.isGooglePlayServicesAvailable(this);
- if (playServicesResult != ConnectionResult.SUCCESS) {
- LOGW(TAG, "Google Play Services was unavailable (code " + playServicesResult + ").");
- if (errorRunnable != null) {
- errorRunnable.run();
- }
- return;
- }
-
- if (mPlayServicesLocationClient != null) {
- // Already trying to obtain a location. Don't call error runnable since this isn't
- // an error.
- return;
- }
-
- LOGD(TAG, "Getting location using Google Play Services.");
- mPlayServicesLocationClient = new LocationClient(this, new ConnectionCallbacks() {
- @Override
- public void onConnected(Bundle bundle) {
- if (mServiceThreadHandler == null) {
- LOGW(TAG, "Service thread handler empty; can't use Play Services location.");
- mPlayServicesLocationClient.disconnect();
- mPlayServicesLocationClient = null;
- if (errorRunnable != null) {
- errorRunnable.run();
- }
- return;
- }
-
- mServiceThreadHandler.post(new Runnable() {
- @Override
- public void run() {
- onHasLocation();
- }
- });
- }
-
- private void onHasLocation() {
- final Location lastLocation = mPlayServicesLocationClient.getLastLocation();
- if (lastLocation == null || (SystemClock.elapsedRealtimeNanos()
- - lastLocation.getElapsedRealtimeNanos()) >= STALE_LOCATION_NANOS) {
- LOGW(TAG, "Stale or missing last-known location; requesting single location "
- + "update.");
- LocationRequest request = LocationRequest.create()
- .setExpirationDuration(LOCATION_TIMEOUT_MILLIS - 1000)
- .setFastestInterval(0)
- .setInterval(0)
- .setNumUpdates(1)
- .setSmallestDisplacement(0)
- .setPriority(LocationRequest.PRIORITY_LOW_POWER);
- mPlayServicesLocationClient.requestLocationUpdates(request,
- PendingIntent.getService(WeatherExtension.this, 0,
- new Intent(WeatherExtension.this, WeatherExtension.class)
- .setAction(ACTION_RECEIVED_LOCATION),
- PendingIntent.FLAG_UPDATE_CURRENT));
-
- // Schedule a retry if timing out. When the location request expires, updates
- // will simply stop, and we won't get any notification of this, so handle it
- // separately.
- mTimeoutHandler.removeCallbacksAndMessages(null);
- mTimeoutHandler.postDelayed(new Runnable() {
- @Override
- public void run() {
- LOGE(TAG, "Play Services location request timed out.");
- disableOneTimeLocationListener();
- scheduleRetry();
- }
- }, LOCATION_TIMEOUT_MILLIS);
- } else {
- tryPublishWeatherUpdateFromGeolocation(lastLocation);
- }
-
- mPlayServicesLocationClient.disconnect();
- mPlayServicesLocationClient = null;
- }
-
- @Override
- public void onDisconnected() {
- mPlayServicesLocationClient = null;
- }
- }, new OnConnectionFailedListener() {
- @Override
- public void onConnectionFailed(ConnectionResult connectionResult) {
- mPlayServicesLocationClient = null;
- if (errorRunnable != null) {
- errorRunnable.run();
- }
- }
- });
- mPlayServicesLocationClient.connect();
+ return;
}
private void tryLocationManagerGetLocationAndPublishWeatherUpdate() {
@@ -365,21 +269,9 @@ public class WeatherExtension extends DashClockExtension {
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
if (intent != null && ACTION_RECEIVED_LOCATION.equals(intent.getAction())) {
- final Location location = intent.getParcelableExtra(
- LocationClient.KEY_LOCATION_CHANGED);
if (mServiceThreadHandler == null) {
LOGW(TAG, "Can't process location update because onUpdateData hasn't been called "
+ "on this service instance.");
- } else if (location != null) {
- // A location update request succeeded; try publishing weather from here.
- LOGD(TAG, "Got a Play Services location update; trying weather update.");
- mTimeoutHandler.removeCallbacksAndMessages(null);
- mServiceThreadHandler.post(new Runnable() {
- @Override
- public void run() {
- tryPublishWeatherUpdateFromGeolocation(location);
- }
- });
}
stopSelf(startId);
@@ -391,9 +283,6 @@ public class WeatherExtension extends DashClockExtension {
@Override
public void onDestroy() {
super.onDestroy();
- if (mPlayServicesLocationClient != null) {
- mPlayServicesLocationClient.disconnect();
- }
disableOneTimeLocationListener();
}
--- a/main/build.gradle
+++ b/main/build.gradle
@@ -36,8 +36,6 @@ repositories {
dependencies {
compile 'com.android.support:support-v13:18.0.0'
- compile 'com.google.android.gms:play-services:4.0.30'
- //compile 'com.mobeta.android.dslv:drag-sort-listview:0.6.1-SNAPSHOT-AAR'
compile 'com.mobeta.android.dslv:drag-sort-listview:0.6.1-SNAPSHOT-AAR@aar'
compile project(':api')
}