Skip to content

Commit

Permalink
Merge branch 'develop' into feature/visual-editor
Browse files Browse the repository at this point in the history
Conflicts:
	WordPress/src/main/java/org/wordpress/android/ui/posts/EditPostActivity.java
  • Loading branch information
aforcier committed Nov 20, 2015
2 parents cf71309 + 19786e0 commit 4171cfd
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 5 deletions.
6 changes: 3 additions & 3 deletions WordPressUtils/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ buildscript {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.3.1'
classpath 'com.android.tools.build:gradle:1.5.0'
}
}

Expand All @@ -20,7 +20,7 @@ dependencies {
exclude group: 'commons-logging'
}
compile 'com.mcxiaoke.volley:library:1.0.18'
compile 'com.android.support:support-v13:23.0.1'
compile 'com.android.support:support-v13:23.1.1'
}

android {
Expand All @@ -29,7 +29,7 @@ android {
publishNonDefault true

compileSdkVersion 23
buildToolsVersion '23.0.1'
buildToolsVersion "23.0.2"

defaultConfig {
versionName "1.5.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ public static <U> U queryJSON(JSONObject source, String query, U defaultObject)
if (result.getClass().isAssignableFrom(defaultObject.getClass())) {
return (U) result;
} else {
AppLog.w(T.UTILS, String.format("The returned object type %s is not assignable to the type %s. Using default!",
result.getClass(),defaultObject.getClass()));
return defaultObject;
}
} catch (java.lang.ClassCastException e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,12 @@ public static String getPhotonImageUrl(String imageUrl, int width, int height, Q
return imageUrl + query;
}

// use wordpress.com as the host if image is on wordpress.com since it supports the same
// query params and, more importantly, can handle images in private blogs
if (imageUrl.contains("wordpress.com")) {
return imageUrl + query;
}

// must use https for https image urls
if (UrlUtils.isHttps(imageUrl)) {
return "https://i0.wp.com/" + imageUrl.substring(schemePos+3, imageUrl.length()) + query;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
//This Handy-Dandy class acquired and tweaked from http://stackoverflow.com/a/3145655/309558
package org.wordpress.android.util.helpers;

import android.annotation.SuppressLint;
import android.app.Activity;
import android.content.Context;
import android.location.Location;
Expand All @@ -18,9 +19,8 @@ public class LocationHelper {
boolean mGpsEnabled = false;
boolean mNetworkEnabled = false;

@SuppressLint("MissingPermission")
public boolean getLocation(Activity activity, LocationResult result) {


mLocationResult = result;
if (mLocationManager == null) {
mLocationManager = (LocationManager) activity.getSystemService(Context.LOCATION_SERVICE);
Expand Down Expand Up @@ -55,6 +55,7 @@ public boolean getLocation(Activity activity, LocationResult result) {
}

LocationListener locationListenerGps = new LocationListener() {
@SuppressLint("MissingPermission")
public void onLocationChanged(Location location) {
mTimer.cancel();
mLocationResult.gotLocation(location);
Expand All @@ -73,6 +74,7 @@ public void onStatusChanged(String provider, int status, Bundle extras) {
};

LocationListener locationListenerNetwork = new LocationListener() {
@SuppressLint("MissingPermission")
public void onLocationChanged(Location location) {
mTimer.cancel();
mLocationResult.gotLocation(location);
Expand All @@ -92,6 +94,7 @@ public void onStatusChanged(String provider, int status, Bundle extras) {

class GetLastLocation extends TimerTask {
@Override
@SuppressLint("MissingPermission")
public void run() {
mLocationManager.removeUpdates(locationListenerGps);
mLocationManager.removeUpdates(locationListenerNetwork);
Expand Down Expand Up @@ -130,6 +133,7 @@ public static abstract class LocationResult {
public abstract void gotLocation(Location location);
}

@SuppressLint("MissingPermission")
public void cancelTimer() {
if (mTimer != null) {
mTimer.cancel();
Expand Down

0 comments on commit 4171cfd

Please sign in to comment.