aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Schneppe <kriztan@users.noreply.github.com>2017-01-31 12:10:49 +0100
committerGitHub <noreply@github.com>2017-01-31 12:10:49 +0100
commit7aa0387ef4a48838180f6219b26ab15d99c10fc8 (patch)
treed700a53619b99a1f2127861d8554ae3f372953f3
parent82025c71254bb757202950d526284a8dd3ddb489 (diff)
add usage comments to checkVersion()
-rw-r--r--src/main/java/de/pixart/messenger/ui/UpdaterActivity.java12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/main/java/de/pixart/messenger/ui/UpdaterActivity.java b/src/main/java/de/pixart/messenger/ui/UpdaterActivity.java
index 548313c6c..b24958a43 100644
--- a/src/main/java/de/pixart/messenger/ui/UpdaterActivity.java
+++ b/src/main/java/de/pixart/messenger/ui/UpdaterActivity.java
@@ -162,6 +162,18 @@ public class UpdaterActivity extends Activity {
alert.show();
}
+ /**
+ * Use this instead of String.compareTo() for a non-lexicographical
+ * comparison that works for version strings. e.g. "1.10".compareTo("1.6").
+ *
+ * @note It does not work if "1.10" is supposed to be equal to "1.10.0".
+ *
+ * @param str1 a string of ordinal numbers separated by decimal points.
+ * @param str2 a string of ordinal numbers separated by decimal points.
+ * @return The result is a negative integer if str1 is _numerically_ less than str2.
+ * The result is a positive integer if str1 is _numerically_ greater than str2.
+ * The result is zero if the strings are _numerically_ equal.
+ */
private int checkVersion(String remoteVersion, String installedVersion) {
String[] remote = null;
String[] installed = null;