| Left: | ||
| Right: |
| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * This file is part of Adblock Plus <https://adblockplus.org/>, | 2 * This file is part of Adblock Plus <https://adblockplus.org/>, |
| 3 * Copyright (C) 2006-2017 eyeo GmbH | 3 * Copyright (C) 2006-2017 eyeo GmbH |
| 4 * | 4 * |
| 5 * Adblock Plus is free software: you can redistribute it and/or modify | 5 * Adblock Plus is free software: you can redistribute it and/or modify |
| 6 * it under the terms of the GNU General Public License version 3 as | 6 * it under the terms of the GNU General Public License version 3 as |
| 7 * published by the Free Software Foundation. | 7 * published by the Free Software Foundation. |
| 8 * | 8 * |
| 9 * Adblock Plus is distributed in the hope that it will be useful, | 9 * Adblock Plus is distributed in the hope that it will be useful, |
| 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| (...skipping 21 matching lines...) Expand all Loading... | |
| 32 private Utils() | 32 private Utils() |
| 33 { | 33 { |
| 34 // | 34 // |
| 35 } | 35 } |
| 36 | 36 |
| 37 public static String getTag(final Class<?> clazz) | 37 public static String getTag(final Class<?> clazz) |
| 38 { | 38 { |
| 39 return clazz.getSimpleName(); | 39 return clazz.getSimpleName(); |
| 40 } | 40 } |
| 41 | 41 |
| 42 public static String capitalizeString(final String s) | |
|
anton
2017/04/17 07:12:46
not used
| |
| 43 { | |
| 44 if (s == null || s.length() == 0) | |
| 45 { | |
| 46 return ""; | |
| 47 } | |
| 48 | |
| 49 final char first = s.charAt(0); | |
| 50 | |
| 51 return Character.isUpperCase(first) ? s : Character.toUpperCase(first) + s.s ubstring(1); | |
| 52 } | |
| 53 | |
| 54 public static void appendRawTextFile(final Context context, final StringBuilde r text, final int id) | |
|
anton
2017/04/17 07:12:46
not used
| |
| 55 { | |
| 56 try | |
| 57 { | |
| 58 final BufferedReader buf = new BufferedReader(new InputStreamReader(contex t.getResources().openRawResource(id))); | |
| 59 | |
| 60 try | |
| 61 { | |
| 62 String line; | |
| 63 while ((line = buf.readLine()) != null) | |
| 64 { | |
| 65 text.append(line); | |
| 66 text.append('\n'); | |
| 67 } | |
| 68 } | |
| 69 finally | |
| 70 { | |
| 71 buf.close(); | |
| 72 } | |
| 73 | |
| 74 } | |
| 75 catch (final Exception e) | |
| 76 { | |
| 77 // Ignored for now | |
| 78 } | |
| 79 } | |
| 80 | |
| 81 public static String stringListToJsonArray(List<String> list) | 42 public static String stringListToJsonArray(List<String> list) |
| 82 { | 43 { |
| 83 JSONArray array = new JSONArray(); | 44 JSONArray array = new JSONArray(); |
| 84 | 45 |
| 85 if (list != null) | 46 if (list != null) |
| 86 { | 47 { |
| 87 for (String eachString : list) | 48 for (String eachString : list) |
| 88 { | 49 { |
| 89 if (eachString != null) | 50 if (eachString != null) |
| 90 { | 51 { |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 130 in.close(); | 91 in.close(); |
| 131 } | 92 } |
| 132 catch (IOException e) | 93 catch (IOException e) |
| 133 { | 94 { |
| 134 // ignored | 95 // ignored |
| 135 } | 96 } |
| 136 } | 97 } |
| 137 } | 98 } |
| 138 } | 99 } |
| 139 } | 100 } |
| OLD | NEW |