Skip to content

Commit 90001f8

Browse files
committed
Squashed 'libs/utils/' changes from 4c6e8c9234..a15de7604a
a15de7604a Merge pull request #25 from wordpress-mobile/deprecate-buggy-date-time-utils-methods 5026dc0904 Mark DateTimeUtils.localDateToUTC and DateTimeUtils.nowUTC as deprecated 58cd5bf239 Mark DateTimeUtils.localDateToUTC and DateTimeUtils.nowUTC as deprecated 4360e5d41f Merge pull request #23 from wordpress-mobile/update-bintray-config 48277981d8 Bump version to 1.23 81f224bd56 Fix Javadoc lint build error when releasing to Bintray 240f2492fa Update Bintray plugin to latest b6abdcae2a Merge pull request #22 from wordpress-mobile/merge-wpa 8260cdce57 Update style and lint configs 7c08103ff2 Update Gradle wrapper version 9666183e69 Merge commit 'a4a756b60bcbf144ed8527f693c4e974fa6e365d' into subtree-updates-v3 cdeb3eb7f1 Merge pull request #9215 from wordpress-mobile/feature/update-support-lib-28 e8dbd8f404 Revert update of targetSdkVersion f7014365ea Update supportLib version to 28.0.0 b3ad4c795e Fix low hanging deprecation warnings b028488305 Remove all instances of LOCATION bd194edb49 Merge pull request #9114 from wordpress-mobile/issue/8177-applog-testing e081d898e7 Merge pull request #9044 from wordpress-mobile/gradle-4-10 2ba6f52024 Move fake AppLog(the one for testing) from utils to the main project 3f74b509d0 Create copy of AppLog for unit testing purposes 78d9bfbf13 fixed merge conflict b3b6665bfd fixed merge conflict c2fa689153 Update to Gradle 4.10.3/Android Gradle plugin 3.2.1 62b03547dc Merge remote-tracking branch 'origin/develop' into feature/master-site-creation f55c4c33b1 Removed duplicated dots from image URL 818c1691c7 Rename NewSiteCreationService props ab051f9083 removed unused imports 0ea8d2aab7 moved unused getDate() method from MediaUtils to getFormattedDateForLastModified() in PostUtils 6e4cecb37b Make the progress of NewSiteCreationService indeterminate 4434057372 Merge branch 'develop' into feature/master-site-creation e7e89ad67e Fix SiteCreation segment icon color tint 2259033733 Merge branch 'develop' into feature/deep-link-main-activity 0671724495 Merge remote-tracking branch 'origin/develop' into feature/deep-linking-improvements 8f5238e5ef Reorder repositories in build.gradle to fix Gradle 4f18db4eb3 Reorder repositories in build.gradle to fix Gradle e695cb4a6b Refactor isDeepLinking to be outside MyProfileActivity d85b6dbb16 Remove unused WPImageGetter 44d63ede88 Add a new type of log tag for pages 5b4a4f09ae Move the logging wrapper class to FluxCUtils for convenience c7c1ff782a Add Crashlytics logging to make sure we're keeping track of problems uploading media d12f32a4a7 Remove coroutines and replace them with standard event driven architecture 5580689d26 Remove unused code - ImageUtils.getThumbnail git-subtree-dir: libs/utils git-subtree-split: a15de7604a34a9e989884fb84b8c9adfaeeb97b0
1 parent a4a756b commit 90001f8

File tree

17 files changed

+116
-276
lines changed

17 files changed

+116
-276
lines changed

.idea/checkstyle-idea.xml

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/codeStyles/Project.xml

Lines changed: 12 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

WordPressUtils/build.gradle

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
buildscript {
22
repositories {
3-
jcenter()
43
google()
4+
jcenter()
55
}
66
dependencies {
7-
classpath 'com.android.tools.build:gradle:3.1.2'
8-
classpath 'com.novoda:bintray-release:0.8.1'
7+
classpath 'com.android.tools.build:gradle:3.2.1'
8+
classpath 'com.novoda:bintray-release:0.9'
99
}
1010
}
1111

@@ -20,21 +20,24 @@ repositories {
2020
dependencies {
2121
implementation 'org.apache.commons:commons-text:1.1'
2222
implementation 'com.mcxiaoke.volley:library:1.0.18'
23-
implementation 'com.android.support:design:27.1.1'
24-
implementation 'com.android.support:recyclerview-v7:27.1.1'
23+
implementation 'com.android.support:design:28.0.0'
24+
implementation 'com.android.support:recyclerview-v7:28.0.0'
2525
implementation 'org.greenrobot:eventbus:3.0.0'
2626

27+
testImplementation 'junit:junit:4.12'
28+
testImplementation 'org.assertj:assertj-core:3.11.1'
29+
2730
lintChecks 'org.wordpress:lint:1.0.1'
2831
}
2932

3033
android {
3134
useLibrary 'org.apache.http.legacy'
3235

33-
compileSdkVersion 27
34-
buildToolsVersion '27.0.3'
36+
compileSdkVersion 28
37+
buildToolsVersion '28.0.3'
3538

3639
defaultConfig {
37-
versionName "1.22"
40+
versionName "1.24"
3841
minSdkVersion 15
3942
targetSdkVersion 26
4043
}

WordPressUtils/src/main/java/org/wordpress/android/util/ActivityUtils.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import android.app.Activity;
44
import android.content.Context;
5+
import android.content.Intent;
56
import android.support.annotation.Nullable;
67
import android.view.View;
78
import android.view.inputmethod.InputMethodManager;
@@ -46,4 +47,8 @@ public static void showKeyboard(@Nullable final View view) {
4647
(InputMethodManager) view.getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
4748
inputMethodManager.showSoftInput(view, InputMethodManager.SHOW_IMPLICIT);
4849
}
50+
51+
public static boolean isDeepLinking(Intent intent) {
52+
return Intent.ACTION_VIEW.equals(intent.getAction());
53+
}
4954
}

WordPressUtils/src/main/java/org/wordpress/android/util/AppLog.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ public enum T {
3535
NOTIFS,
3636
DB,
3737
POSTS,
38+
PAGES,
3839
COMMENTS,
3940
THEMES,
4041
TESTS,
@@ -48,7 +49,9 @@ public enum T {
4849
SHARING,
4950
PLUGINS,
5051
ACTIVITY_LOG,
51-
SUPPORT
52+
JETPACK_REMOTE_INSTALL,
53+
SUPPORT,
54+
SITE_CREATION
5255
}
5356

5457
public static final String TAG = "WordPress";

WordPressUtils/src/main/java/org/wordpress/android/util/AutoForeground.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ protected void setState(StateClass newState) {
174174
}
175175
}
176176

177-
private void track(ServiceState state) {
177+
protected void track(ServiceState state) {
178178
Map<String, Object> props = new HashMap<>();
179179
props.put("login_phase", state == null ? "null" : state.getStepName());
180180
props.put("login_service_is_foreground", isForeground());

WordPressUtils/src/main/java/org/wordpress/android/util/AutoForegroundNotification.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,14 @@ public static Notification progress(Context context, String channelId, int progr
5656
.build();
5757
}
5858

59+
public static Notification progressIndeterminate(Context context, String channelId, @StringRes int title,
60+
@StringRes int content, @DrawableRes int icon,
61+
@ColorRes int accentColor) {
62+
return getNotificationBuilder(context, channelId, NOTIFICATION_ID_PROGRESS, title, content, icon, accentColor)
63+
.setProgress(0, 0, true)
64+
.build();
65+
}
66+
5967
public static Notification success(Context context, String channelId, @StringRes int title, @StringRes int content,
6068
@DrawableRes int icon, @ColorRes int accentColor) {
6169
return getNotificationBuilder(context, channelId, NOTIFICATION_ID_SUCCESS, title, content, icon, accentColor)

WordPressUtils/src/main/java/org/wordpress/android/util/DateTimeUtils.java

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,13 +112,25 @@ public static String iso8601UTCFromDate(Date date) {
112112
}
113113

114114
/**
115-
* Returns the current UTC date
115+
* Returns the current UTC date.
116+
*
117+
* @deprecated This method doesn't work as expected and shouldn't be used in production code. It doesn't take
118+
* into account that `Date` class uses TimeZone.getDefault(). It substracts the currentOffsetFromUTC, but the
119+
* final date still uses system default timezone.
116120
*/
121+
@Deprecated
117122
public static Date nowUTC() {
118123
Date dateTimeNow = new Date();
119124
return localDateToUTC(dateTimeNow);
120125
}
121126

127+
/**
128+
*
129+
* @deprecated This method doesn't work as expected and shouldn't be used in production code. It doesn't take
130+
* into account that `Date` class uses TimeZone.getDefault(). It substracts the currentOffsetFromUTC, but the
131+
* final date still uses system default timezone.
132+
*/
133+
@Deprecated
122134
public static Date localDateToUTC(Date dtLocal) {
123135
if (dtLocal == null) {
124136
return null;

WordPressUtils/src/main/java/org/wordpress/android/util/DeviceUtils.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,7 @@ private static long availableSpaceAtFilePath(File path) {
144144
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.JELLY_BEAN_MR2) {
145145
return stat.getBlockSizeLong() * stat.getAvailableBlocksLong();
146146
} else {
147+
//noinspection deprecation - Deprecated calls properly handled
147148
bytesAvailable = (long) stat.getBlockSize() * (long) stat.getAvailableBlocks();
148149
}
149150
return bytesAvailable;

WordPressUtils/src/main/java/org/wordpress/android/util/ImageUtils.java

Lines changed: 0 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -847,43 +847,6 @@ public static String rotateImageIfNecessary(Context context, String path) {
847847
return null;
848848
}
849849

850-
/**
851-
* This is a wrapper around MediaStore.Images.Thumbnails.getThumbnail that takes in consideration
852-
* the orientation of the picture.
853-
*
854-
* @param contentResolver ContentResolver used to dispatch queries to MediaProvider.
855-
* @param id Original image id associated with thumbnail of interest.
856-
* @param kind The type of thumbnail to fetch. Should be either MINI_KIND or MICRO_KIND.
857-
*
858-
* @return A Bitmap instance. It could be null if the original image
859-
* associated with origId doesn't exist or memory is not enough.
860-
*/
861-
public static Bitmap getThumbnail(ContentResolver contentResolver, long id, int kind) {
862-
Cursor cursor = contentResolver.query(MediaStore.Images.Media.EXTERNAL_CONTENT_URI,
863-
new String[]{MediaStore.Images.Media.DATA}, // Which columns to return
864-
MediaStore.Images.Media._ID + "=?", // Which rows to return
865-
new String[]{String.valueOf(id)}, // Selection arguments
866-
null); // order
867-
868-
if (cursor != null && cursor.getCount() > 0) {
869-
cursor.moveToFirst();
870-
String filepath = cursor.getString(0);
871-
cursor.close();
872-
int rotation = getExifOrientation(filepath);
873-
Bitmap bitmap = MediaStore.Images.Thumbnails.getThumbnail(contentResolver, id, kind, null);
874-
875-
if (rotation != 0 && bitmap != null) {
876-
Matrix matrix = new Matrix();
877-
matrix.setRotate(rotation);
878-
bitmap = Bitmap.createBitmap(bitmap, 0, 0, bitmap.getWidth(), bitmap.getHeight(), matrix, true);
879-
}
880-
881-
return bitmap;
882-
}
883-
884-
return null;
885-
}
886-
887850
// determine correct scale value (should be power of 2)
888851
// http://stackoverflow.com/questions/477572/android-strange-out-of-memory-issue/3549021#3549021
889852
protected static int getScaleForResizing(int maxSize, BitmapFactory.Options optBounds) {

0 commit comments

Comments
 (0)