| 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-2016 Eyeo GmbH | 3 * Copyright (C) 2006-2016 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 14 matching lines...) Expand all Loading... |
| 25 import org.adblockplus.libadblockplus.Subscription; | 25 import org.adblockplus.libadblockplus.Subscription; |
| 26 import org.apache.commons.lang.StringUtils; | 26 import org.apache.commons.lang.StringUtils; |
| 27 | 27 |
| 28 import android.app.Notification; | 28 import android.app.Notification; |
| 29 import android.app.NotificationManager; | 29 import android.app.NotificationManager; |
| 30 import android.app.PendingIntent; | 30 import android.app.PendingIntent; |
| 31 import android.content.Context; | 31 import android.content.Context; |
| 32 import android.content.Intent; | 32 import android.content.Intent; |
| 33 import android.support.v4.app.NotificationCompat; | 33 import android.support.v4.app.NotificationCompat; |
| 34 | 34 |
| 35 public final class Utils | 35 public final class AppUtils |
| 36 { | 36 { |
| 37 private Utils() | 37 private AppUtils() |
| 38 { | 38 { |
| 39 // | 39 // |
| 40 } | 40 } |
| 41 | 41 |
| 42 public static String getTag(final Class<?> clazz) | |
| 43 { | |
| 44 return clazz.getSimpleName(); | |
| 45 } | |
| 46 | |
| 47 public static String capitalizeString(final String s) | |
| 48 { | |
| 49 if (s == null || s.length() == 0) | |
| 50 { | |
| 51 return ""; | |
| 52 } | |
| 53 | |
| 54 final char first = s.charAt(0); | |
| 55 | |
| 56 return Character.isUpperCase(first) ? s : Character.toUpperCase(first) + s.s
ubstring(1); | |
| 57 } | |
| 58 | |
| 59 protected static void showUpdateNotification(final Context context, final Stri
ng url, | 42 protected static void showUpdateNotification(final Context context, final Stri
ng url, |
| 60 final String error) | 43 final String error) |
| 61 { | 44 { |
| 62 final NotificationCompat.Builder builder = new NotificationCompat.Builder(co
ntext); | 45 final NotificationCompat.Builder builder = new NotificationCompat.Builder(co
ntext); |
| 63 builder.setContentTitle(context.getText(R.string.app_name)); | 46 builder.setContentTitle(context.getText(R.string.app_name)); |
| 64 builder.setSmallIcon(R.drawable.ic_stat_warning); | 47 builder.setSmallIcon(R.drawable.ic_stat_warning); |
| 65 builder.setAutoCancel(true); | 48 builder.setAutoCancel(true); |
| 66 builder.setOnlyAlertOnce(true); | 49 builder.setOnlyAlertOnce(true); |
| 67 final PendingIntent emptyIntent = PendingIntent.getActivity(context, 0, new
Intent(), 0); | 50 final PendingIntent emptyIntent = PendingIntent.getActivity(context, 0, new
Intent(), 0); |
| 68 builder.setContentIntent(emptyIntent); | 51 builder.setContentIntent(emptyIntent); |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 buf.close(); | 126 buf.close(); |
| 144 } | 127 } |
| 145 | 128 |
| 146 } | 129 } |
| 147 catch (final Exception e) | 130 catch (final Exception e) |
| 148 { | 131 { |
| 149 // Ignored for now | 132 // Ignored for now |
| 150 } | 133 } |
| 151 } | 134 } |
| 152 } | 135 } |
| OLD | NEW |