1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-07-17 19:04:03 +02:00

Comment out excessive logging #1311

This commit is contained in:
cpfeiffer 2018-11-03 23:26:07 +01:00
parent 17a82f09f2
commit 7cfe7d900a

View File

@ -1,7 +1,6 @@
package nodomain.freeyourgadget.gadgetbridge.util; package nodomain.freeyourgadget.gadgetbridge.util;
import android.text.TextUtils; import android.text.TextUtils;
import android.util.Log;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
@ -476,17 +475,16 @@ public class RtlUtils {
* The function get a string and fix the rtl words. * The function get a string and fix the rtl words.
* since simple reverse puts the beginning of the text at the end, the text should have been from bottom to top. * since simple reverse puts the beginning of the text at the end, the text should have been from bottom to top.
* To avoid that, we save the text in lines (line max size can be change in the settings) * To avoid that, we save the text in lines (line max size can be change in the settings)
* @param s - the string to fix. * @param oldString - the string to fix.
* @return a fix string. * @return a fix string.
*/ */
public static String fixRtl(String s) { public static String fixRtl(String oldString) {
if (s == null || s.isEmpty()){ if (oldString == null || oldString.isEmpty()){
return s; return oldString;
} }
Log.d("ROIGR", "before: |" + org.apache.commons.lang3.StringEscapeUtils.escapeJava(s) + "|"); debug("before: |" + org.apache.commons.lang3.StringEscapeUtils.escapeJava(oldString) + "|");
int length = s.length(); int length = oldString.length();
String oldString = s.substring(0, length);
String newString = ""; String newString = "";
List<String> lines = new ArrayList<>(); List<String> lines = new ArrayList<>();
char[] newWord = new char[length]; char[] newWord = new char[length];
@ -507,8 +505,8 @@ public class RtlUtils {
for (int i = 0; i < length; i++) { for (int i = 0; i < length; i++) {
c = oldString.charAt(i); c = oldString.charAt(i);
addCharToWord = false; addCharToWord = false;
Log.d("ROIGR", "char: " + c + " :" + Character.getDirectionality(c)); debug("char: " + c + " :" + Character.getDirectionality(c));
// Log.d("ROIGR", "hex : " + (int)c); // debug( "hex : " + (int)c);
if (isLtr(c)){ if (isLtr(c)){
CurRtlType = characterType.ltr; CurRtlType = characterType.ltr;
@ -517,7 +515,7 @@ public class RtlUtils {
} }
if ((CurRtlType == PhraseRtlType) && !(isSpaceSign(c) || isEndLineSign(c))){ if ((CurRtlType == PhraseRtlType) && !(isSpaceSign(c) || isEndLineSign(c))){
Log.d("ROIGR", "add: " + c + " to: " + word); debug("add: " + c + " to: " + word);
word.append(c); word.append(c);
addCharToWord = true; addCharToWord = true;
if (i < length - 1) { if (i < length - 1) {
@ -545,7 +543,7 @@ public class RtlUtils {
phraseString = phrase.toString(); phraseString = phrase.toString();
Log.d("ROIGR", "phrase: |" + phraseString + "|"); debug("phrase: |" + phraseString + "|");
if (PhraseRtlType == characterType.rtl) { if (PhraseRtlType == characterType.rtl) {
if (contextualSupport()) { if (contextualSupport()) {
phraseString = convertToContextual(phraseString); phraseString = convertToContextual(phraseString);
@ -554,7 +552,7 @@ public class RtlUtils {
} }
line.insert(0, fixWhitespace(phraseString)); line.insert(0, fixWhitespace(phraseString));
Log.d("ROIGR", "line now: |" + line + "|"); debug("line now: |" + line + "|");
phrase.setLength(0); phrase.setLength(0);
if (word.length() > 0){ if (word.length() > 0){
@ -572,7 +570,7 @@ public class RtlUtils {
} }
lines.add(line.toString()); lines.add(line.toString());
Log.d("ROIGR", "line: |" + line + "|"); debug("line: |" + line + "|");
line.setLength(0); line.setLength(0);
if (word.length() == 0){ if (word.length() == 0){
@ -587,8 +585,12 @@ public class RtlUtils {
newString = TextUtils.join("", lines); newString = TextUtils.join("", lines);
Log.d("ROIGR", "after : |" + org.apache.commons.lang3.StringEscapeUtils.escapeJava(newString) + "|"); debug("after : |" + org.apache.commons.lang3.StringEscapeUtils.escapeJava(newString) + "|");
return newString; return newString;
} }
private static void debug(String s) {
// Log.d("ROIGR", s);
}
} }