Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: submodules/libadblockplus-android/libadblockplus-android/src/org/adblockplus/android/Utils.java

Issue 29345540: Issue 4030 - Move JNI bindings into separate library project (Closed)
Patch Set: Created June 3, 2016, 1:42 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: submodules/libadblockplus-android/libadblockplus-android/src/org/adblockplus/android/Utils.java
===================================================================
rename from src/org/adblockplus/android/Utils.java
rename to submodules/libadblockplus-android/libadblockplus-android/src/org/adblockplus/android/Utils.java
--- a/src/org/adblockplus/android/Utils.java
+++ b/submodules/libadblockplus-android/libadblockplus-android/src/org/adblockplus/android/Utils.java
@@ -15,27 +15,25 @@
* along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>.
*/
package org.adblockplus.android;
import java.io.BufferedReader;
import java.io.InputStreamReader;
-import org.adblockplus.android.updater.UpdaterActivity;
import org.adblockplus.libadblockplus.JsValue;
import org.adblockplus.libadblockplus.Subscription;
import org.apache.commons.lang.StringUtils;
import android.app.Notification;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;
-import android.support.v4.app.NotificationCompat;
public final class Utils
{
private Utils()
{
//
}
@@ -51,83 +49,16 @@
return "";
}
final char first = s.charAt(0);
return Character.isUpperCase(first) ? s : Character.toUpperCase(first) + s.substring(1);
}
- protected static void showUpdateNotification(final Context context, final String url,
- final String error)
- {
- final NotificationCompat.Builder builder = new NotificationCompat.Builder(context);
- builder.setContentTitle(context.getText(R.string.app_name));
- builder.setSmallIcon(R.drawable.ic_stat_warning);
- builder.setAutoCancel(true);
- builder.setOnlyAlertOnce(true);
- final PendingIntent emptyIntent = PendingIntent.getActivity(context, 0, new Intent(), 0);
- builder.setContentIntent(emptyIntent);
-
- if (StringUtils.isNotEmpty(error))
- {
- builder.setContentText(context.getString(R.string.msg_update_fail));
- }
- else if (StringUtils.isNotEmpty(url))
- {
- builder.setSmallIcon(R.drawable.ic_stat_download);
- final Intent intent = new Intent(context, UpdaterActivity.class)
- .addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
- intent.setAction("download");
- intent.putExtra("url", url);
- final PendingIntent updateIntent =
- PendingIntent.getActivity(context, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT);
- builder.setContentIntent(updateIntent);
- builder.setContentText(context.getString(R.string.msg_update_available));
- }
- else
- {
- builder.setContentText(context.getString(R.string.msg_update_missing));
- }
-
- final Notification notification = builder.getNotification();
- final NotificationManager notificationManager =
- (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
- notificationManager.notify(AdblockPlus.UPDATE_NOTIFICATION_ID, notification);
- }
-
- protected static void updateSubscriptionStatus(final Context context, final Subscription sub)
- {
- final JsValue jsDownloadStatus = sub.getProperty("downloadStatus");
- final String downloadStatus = jsDownloadStatus.isNull() ? "" : jsDownloadStatus.toString();
- final long lastDownload = sub.getProperty("lastDownload").asLong();
-
- String status = "synchronize_never";
- long time = 0;
-
- if (sub.isUpdating())
- {
- status = "synchronize_in_progress";
- }
- else if (StringUtils.isNotEmpty(downloadStatus) && !downloadStatus.equals("synchronize_ok"))
- {
- status = downloadStatus;
- }
- else if (lastDownload > 0)
- {
- time = lastDownload;
- status = "synchronize_last_at";
- }
-
- context.sendBroadcast(new Intent(AdblockPlus.BROADCAST_SUBSCRIPTION_STATUS)
- .putExtra("url", sub.getProperty("url").toString())
- .putExtra("status", status)
- .putExtra("time", time * 1000L));
- }
-
public static void appendRawTextFile(final Context context, final StringBuilder text, final int id)
diegocarloslima 2016/09/06 01:05:50 This method isn't called by the lib and is redunda
anton 2016/09/06 05:56:23 Same reason: don't do any modifications for the so
{
try
{
final BufferedReader buf = new BufferedReader(new InputStreamReader(context.getResources().openRawResource(id)));
try
{

Powered by Google App Engine
This is Rietveld