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

Side by Side Diff: adblockplussbrowser/src/main/java/org/adblockplus/sbrowser/contentblocker/ConnectivityChanged.java

Issue 29603697: Issue 5931 - Create tests for util package (Closed)
Patch Set: Created Nov. 10, 2017, 2:23 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 /*
2 * This file is part of Adblock Plus <https://adblockplus.org/>,
3 * Copyright (C) 2006-present eyeo GmbH
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * Adblock Plus is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18 package org.adblockplus.sbrowser.contentblocker;
19
20 import org.adblockplus.sbrowser.contentblocker.engine.Engine;
21 import org.adblockplus.sbrowser.contentblocker.engine.EngineService;
22
23 import android.content.BroadcastReceiver;
24 import android.content.Context;
25 import android.content.Intent;
26 import android.util.Log;
27
28 public class ConnectivityChanged extends BroadcastReceiver implements
29 EngineService.OnEngineCreatedCallback
30 {
31 private static final String TAG = ConnectivityChanged.class.getSimpleName();
32
33 private static final String ACTION = "android.net.conn.CONNECTIVITY_CHANGE";
34
35 @Override
36 public void onReceive(final Context context, final Intent intent)
37 {
38 if (intent != null && ACTION.equals(intent.getAction()))
39 {
40 Log.d(TAG, "Triggering connectivity changed event");
41 EngineService.startService(context, this);
42 }
43 }
44
45 @Override
46 public void onEngineCreated(Engine engine, boolean success)
47 {
48 if (success)
49 {
50 engine.connectivityChanged();
51 }
52 }
53 }
OLDNEW

Powered by Google App Engine
This is Rietveld