diff --git a/app/src/main/java/com/keylesspalace/tusky/util/CountUpDownLatch.java b/app/src/main/java/com/keylesspalace/tusky/util/CountUpDownLatch.java index 5791cf60..6874337b 100644 --- a/app/src/main/java/com/keylesspalace/tusky/util/CountUpDownLatch.java +++ b/app/src/main/java/com/keylesspalace/tusky/util/CountUpDownLatch.java @@ -15,6 +15,13 @@ package com.keylesspalace.tusky.util; +/** + * This is a synchronization primitive related to {@link java.util.concurrent.CountDownLatch} + * except that it starts at zero and can count upward. + *
+ * The intended use case is for waiting for all tasks to be finished when the number of tasks isn't
+ * known ahead of time, or may change while waiting.
+ */
public class CountUpDownLatch {
private int count;
diff --git a/app/src/main/java/com/keylesspalace/tusky/util/DateUtils.java b/app/src/main/java/com/keylesspalace/tusky/util/DateUtils.java
index beb58ef9..3d32d08a 100644
--- a/app/src/main/java/com/keylesspalace/tusky/util/DateUtils.java
+++ b/app/src/main/java/com/keylesspalace/tusky/util/DateUtils.java
@@ -20,8 +20,10 @@ import android.content.Context;
import com.keylesspalace.tusky.R;
public class DateUtils {
- /* This is a rough duplicate of android.text.format.DateUtils.getRelativeTimeSpanString,
- * but even with the FORMAT_ABBREV_RELATIVE flag it wasn't abbreviating enough. */
+ /**
+ * This is a rough duplicate of {@link android.text.format.DateUtils#getRelativeTimeSpanString},
+ * but even with the FORMAT_ABBREV_RELATIVE flag it wasn't abbreviating enough.
+ */
public static String getRelativeTimeSpanString(Context context, long then, long now) {
final long MINUTE = 60;
final long HOUR = 60 * MINUTE;
diff --git a/app/src/main/java/com/keylesspalace/tusky/util/DownsizeImageTask.java b/app/src/main/java/com/keylesspalace/tusky/util/DownsizeImageTask.java
index fe222a70..c9df6a19 100644
--- a/app/src/main/java/com/keylesspalace/tusky/util/DownsizeImageTask.java
+++ b/app/src/main/java/com/keylesspalace/tusky/util/DownsizeImageTask.java
@@ -32,6 +32,10 @@ import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;
+/**
+ * Reduces the file size of images to fit under a given limit by resizing them, maintaining both
+ * aspect ratio and orientation.
+ */
public class DownsizeImageTask extends AsyncTask
* It first tries the "approved" list of cipher suites given in OkHttp (the default in
* ConnectionSpec.MODERN_TLS) and if that doesn't work falls back to the set of ALL enabled,
* then falls back to plain http.
- *
+ *
* API level 24 has a regression in elliptic curves where it only supports secp256r1, so this
* first tries a fallback without elliptic curves at all, and then tries them after.
- *
+ *
* TLS 1.1 and 1.2 have to be manually enabled on API levels 16-20.
*/
@NonNull
@@ -104,7 +104,6 @@ public class OkHttpUtils {
};
}
-
/**
* Android version Nougat has a regression where elliptic curve cipher suites are supported, but
* only the curve secp256r1 is allowed. So, first it's best to just disable all elliptic
diff --git a/app/src/main/java/com/keylesspalace/tusky/util/ParserUtils.java b/app/src/main/java/com/keylesspalace/tusky/util/ParserUtils.java
index da35a8f4..b0072ee9 100644
--- a/app/src/main/java/com/keylesspalace/tusky/util/ParserUtils.java
+++ b/app/src/main/java/com/keylesspalace/tusky/util/ParserUtils.java
@@ -19,7 +19,7 @@ import java.util.List;
import static com.keylesspalace.tusky.util.StringUtils.QUOTE;
/**
- * Inspect and Get the information from an URL
+ * Inspect and get the information from a URL.
*/
public class ParserUtils {
private static final String TAG = "ParserUtils";
@@ -56,7 +56,7 @@ public class ParserUtils {
clipboard.setPrimaryClip(clip);
}
- // parse the HTML page
+ /** parse the HTML page */
private HeaderInfo parsePageHeaderInfo(String urlStr) throws Exception {
Connection con = Jsoup.connect(urlStr);
HeaderInfo headerInfo = new HeaderInfo();
diff --git a/app/src/main/java/com/keylesspalace/tusky/util/SpanUtils.java b/app/src/main/java/com/keylesspalace/tusky/util/SpanUtils.java
index f2270117..e5697d5c 100644
--- a/app/src/main/java/com/keylesspalace/tusky/util/SpanUtils.java
+++ b/app/src/main/java/com/keylesspalace/tusky/util/SpanUtils.java
@@ -23,8 +23,16 @@ import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class SpanUtils {
+ /**
+ * @see
+ * Tag#HASHTAG_RE.
+ */
private static final String TAG_REGEX = "(?:^|[^/)\\w])#([\\w_]*[\\p{Alpha}_][\\w_]*)";
private static Pattern TAG_PATTERN = Pattern.compile(TAG_REGEX, Pattern.CASE_INSENSITIVE);
+ /**
+ * @see
+ * Account#MENTION_RE
+ */
private static final String MENTION_REGEX =
"(?:^|[^/[:word:]])@([a-z0-9_]+(?:@[a-z0-9\\.\\-]+[a-z0-9]+)?)";
private static Pattern MENTION_PATTERN =
@@ -98,6 +106,7 @@ public class SpanUtils {
}
}
+ /** Takes text containing mentions and hashtags and makes them the given colour. */
public static void highlightSpans(Spannable text, int colour) {
// Strip all existing colour spans.
int n = text.length();
diff --git a/app/src/main/java/com/keylesspalace/tusky/util/ThemeUtils.java b/app/src/main/java/com/keylesspalace/tusky/util/ThemeUtils.java
index 310341fa..6666c8fa 100644
--- a/app/src/main/java/com/keylesspalace/tusky/util/ThemeUtils.java
+++ b/app/src/main/java/com/keylesspalace/tusky/util/ThemeUtils.java
@@ -26,6 +26,10 @@ import android.support.v4.content.ContextCompat;
import android.util.TypedValue;
import android.widget.ImageView;
+/**
+ * Provides runtime compatibility to obtain theme information and re-theme views, especially where
+ * the ability to do so is not supported in resource files.
+ */
public class ThemeUtils {
public static Drawable getDrawable(Context context, @AttrRes int attribute,
@DrawableRes int fallbackDrawable) {