Skip to content

Commit 3c894b2

Browse files
committed
move WPEditText to WordPressUtils and reorganize WordPressUtils
1 parent ed26387 commit 3c894b2

16 files changed

+86
-24
lines changed

WordPressUtils/src/main/java/org/wordpress/android/util/AlertUtil.java renamed to WordPressUtils/src/main/java/org/wordpress/android/util/AlertUtils.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
import android.content.Context;
2222
import android.content.DialogInterface;
2323

24-
public class AlertUtil {
24+
public class AlertUtils {
2525
/**
2626
* Show Alert Dialog
2727
* @param context

WordPressUtils/src/main/java/org/wordpress/android/util/Emoticons.java renamed to WordPressUtils/src/main/java/org/wordpress/android/util/EmoticonsUtils.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
import static android.os.Build.VERSION.SDK_INT;
1515
import static android.os.Build.VERSION_CODES;
1616

17-
public class Emoticons {
17+
public class EmoticonsUtils {
1818
public static final int EMOTICON_COLOR = 0xFF21759B;
1919
private static final boolean HAS_EMOJI = SDK_INT >= VERSION_CODES.JELLY_BEAN;
2020
private static final Map<String, String> wpSmilies;
@@ -82,7 +82,7 @@ public static String lookupImageSmiley(String url, String ifNone){
8282
public static Spanned replaceEmoticonsWithEmoji(SpannableStringBuilder html){
8383
ImageSpan imgs[] = html.getSpans(0, html.length(), ImageSpan.class);
8484
for (ImageSpan img : imgs) {
85-
String emoticon = Emoticons.lookupImageSmiley(img.getSource());
85+
String emoticon = EmoticonsUtils.lookupImageSmiley(img.getSource());
8686
if (!emoticon.equals("")) {
8787
int start = html.getSpanStart(img);
8888
html.replace(start, html.getSpanEnd(img), emoticon);
@@ -103,4 +103,4 @@ public static String replaceEmoticonsWithEmoji(final String text) {
103103
return text;
104104
}
105105
}
106-
}
106+
}

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

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@
1010
import android.text.style.QuoteSpan;
1111

1212
import org.apache.commons.lang.StringEscapeUtils;
13+
import org.wordpress.android.util.helpers.WPHtmlTagHandler;
14+
import org.wordpress.android.util.helpers.WPImageGetter;
15+
import org.wordpress.android.util.helpers.WPQuoteSpan;
1316

1417
public class HtmlUtils {
1518
/*
@@ -111,7 +114,7 @@ public static String stripScript(final String text) {
111114
}
112115

113116
/**
114-
* an alternative to Html.fromHtml() supporting <ul>, <ol>, <blockquote> tags and replacing Emoticons with Emojis
117+
* an alternative to Html.fromHtml() supporting <ul>, <ol>, <blockquote> tags and replacing EmoticonsUtils with Emojis
115118
*/
116119
public static SpannableStringBuilder fromHtml(String source, WPImageGetter wpImageGetter) {
117120
SpannableStringBuilder html;
@@ -121,7 +124,7 @@ public static SpannableStringBuilder fromHtml(String source, WPImageGetter wpIma
121124
// In case our tag handler fails
122125
html = (SpannableStringBuilder) Html.fromHtml(source, wpImageGetter, null);
123126
}
124-
Emoticons.replaceEmoticonsWithEmoji(html);
127+
EmoticonsUtils.replaceEmoticonsWithEmoji(html);
125128
QuoteSpan spans[] = html.getSpans(0, html.length(), QuoteSpan.class);
126129
for (QuoteSpan span : spans) {
127130
html.setSpan(new WPQuoteSpan(), html.getSpanStart(span), html.getSpanEnd(span), html.getSpanFlags(span));

WordPressUtils/src/main/java/org/wordpress/android/util/JSONUtil.java renamed to WordPressUtils/src/main/java/org/wordpress/android/util/JSONUtils.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
import java.util.ArrayList;
1111
import java.util.Iterator;
1212

13-
public class JSONUtil {
13+
public class JSONUtils {
1414
private static String QUERY_SEPERATOR=".";
1515
private static String QUERY_ARRAY_INDEX_START="[";
1616
private static String QUERY_ARRAY_INDEX_END="]";
@@ -19,7 +19,7 @@ public class JSONUtil {
1919

2020
private static final String JSON_NULL_STR = "null";
2121

22-
private static final String TAG="JSONUtil";
22+
private static final String TAG="JSONUtils";
2323
/**
2424
* Given a JSONObject and a key path (e.g property.child) and a default it will
2525
* traverse the object graph and pull out the desired property
@@ -232,4 +232,4 @@ public static JSONObject getJSONChild(final JSONObject jsonParent, final String
232232
}
233233
return jsonChild;
234234
}
235-
}
235+
}

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -214,8 +214,8 @@ public static String replaceUnicodeSurrogateBlocksWithHTMLEntities(final String
214214
final int codepoint = inputString.codePointAt(offset);
215215
final char current = inputString.charAt(offset);
216216
if (Character.isHighSurrogate(current) || Character.isLowSurrogate(current)) {
217-
if (Emoticons.wpSmiliesCodePointToText.get(codepoint) != null) {
218-
out.append(Emoticons.wpSmiliesCodePointToText.get(codepoint));
217+
if (EmoticonsUtils.wpSmiliesCodePointToText.get(codepoint) != null) {
218+
out.append(EmoticonsUtils.wpSmiliesCodePointToText.get(codepoint));
219219
} else {
220220
final String htmlEscapedChar = "&#x" + Integer.toHexString(codepoint) + ";";
221221
out.append(htmlEscapedChar);
@@ -275,4 +275,4 @@ public static int stringToInt(String s, int defaultValue) {
275275
return defaultValue;
276276
}
277277
}
278-
}
278+
}

WordPressUtils/src/main/java/org/wordpress/android/util/UserEmail.java renamed to WordPressUtils/src/main/java/org/wordpress/android/util/UserEmailUtils.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
import java.util.regex.Pattern;
99

10-
public class UserEmail {
10+
public class UserEmailUtils {
1111
/**
1212
* Get primary account and return its name if it matches the email address pattern.
1313
*

WordPressUtils/src/main/java/org/wordpress/android/util/ListScrollPositionManager.java renamed to WordPressUtils/src/main/java/org/wordpress/android/util/helpers/ListScrollPositionManager.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package org.wordpress.android.util;
1+
package org.wordpress.android.util.helpers;
22

33
import android.content.Context;
44
import android.content.SharedPreferences;

WordPressUtils/src/main/java/org/wordpress/android/util/LocationHelper.java renamed to WordPressUtils/src/main/java/org/wordpress/android/util/helpers/LocationHelper.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//This Handy-Dandy class acquired and tweaked from http://stackoverflow.com/a/3145655/309558
2-
package org.wordpress.android.util;
2+
package org.wordpress.android.util.helpers;
33

44
import java.util.Timer;
55
import java.util.TimerTask;

WordPressUtils/src/main/java/org/wordpress/android/util/ptr/SwipeToRefreshHelper.java renamed to WordPressUtils/src/main/java/org/wordpress/android/util/helpers/SwipeToRefreshHelper.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package org.wordpress.android.util.ptr;
1+
package org.wordpress.android.util.helpers;
22

33
import android.app.Activity;
44
import android.content.Context;

WordPressUtils/src/main/java/org/wordpress/android/util/Version.java renamed to WordPressUtils/src/main/java/org/wordpress/android/util/helpers/Version.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package org.wordpress.android.util;
1+
package org.wordpress.android.util.helpers;
22

33
//See: http://stackoverflow.com/a/11024200
44
public class Version implements Comparable<Version> {
@@ -44,4 +44,4 @@ public Version(String version) {
4444
return false;
4545
return this.compareTo((Version) that) == 0;
4646
}
47-
}
47+
}

0 commit comments

Comments
 (0)