diff options
author | uberspot <onexemailx@gmail.com> | 2014-03-11 04:13:58 +0200 |
---|---|---|
committer | uberspot <onexemailx@gmail.com> | 2014-03-11 04:13:58 +0200 |
commit | e8122df35d71bc09013dcc90d35fadbb1126b0cd (patch) | |
tree | 66c6db94fb257790f0f4c58285d192f80707dc85 /OpenPGP-Keychain/src/main | |
parent | 43a20ad1da62a32eb48ecedcd6dc33df5396dfeb (diff) | |
download | open-keychain-e8122df35d71bc09013dcc90d35fadbb1126b0cd.tar.gz open-keychain-e8122df35d71bc09013dcc90d35fadbb1126b0cd.tar.bz2 open-keychain-e8122df35d71bc09013dcc90d35fadbb1126b0cd.zip |
minor clean up in colorize method
Diffstat (limited to 'OpenPGP-Keychain/src/main')
-rw-r--r-- | OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/ViewKeyMainFragment.java | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/ViewKeyMainFragment.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/ViewKeyMainFragment.java index 65fe08484..adb06a068 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/ViewKeyMainFragment.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/ViewKeyMainFragment.java @@ -280,13 +280,14 @@ public class ViewKeyMainFragment extends Fragment implements // for each 4 characters of the fingerprint + 1 space for (int i = 0; i < fingerprint.length(); i += 5) { - String fourChars = fingerprint.substring(i, Math.min(i + 4, fingerprint.length())); + int minFingLength = Math.min(i + 4, fingerprint.length()); + String fourChars = fingerprint.substring(i, minFingLength); // Create a foreground color by converting the 4 fingerprint chars to an int hashcode // and then converting that int to hex to use as a color fcs = new ForegroundColorSpan( Color.parseColor(String.format("#%06X", (0xFFFFFF & fourChars.hashCode())))); - sb.setSpan(fcs, i, Math.min(i+4, fingerprint.length()), Spannable.SPAN_INCLUSIVE_INCLUSIVE); + sb.setSpan(fcs, i, minFingLength, Spannable.SPAN_INCLUSIVE_INCLUSIVE); } return sb; |