|
@ -30,8 +30,9 @@ Caracteristici:
|
|||
- Gratis
|
||||
- Software cu sursa deschisa
|
||||
- Nu foloseste baterie in plus
|
||||
- Nu reduce latimea de banda
|
||||
- Nu transmite datele nicaieri
|
||||
- Nu urmareste activitatea si nu a analizeaza
|
||||
- Nu urmareste activitatea si nici nu o analizeaza
|
||||
- Fara reclama
|
||||
- Suporta IPv4/IPv6 TCP/UDP
|
||||
- Blocheaza atat aplicatiile de sistem cat si cele ale utilizatorului
|
||||
|
|
1
PLAY.md
|
@ -30,6 +30,7 @@ Features:
|
|||
- Free of charge
|
||||
- Open source
|
||||
- No extra battery usage
|
||||
- No bandwidth reduction
|
||||
- No calling home
|
||||
- No tracking or analytics
|
||||
- No ads
|
||||
|
|
28
README.md
|
@ -12,6 +12,7 @@ Blocking access to the internet can help:
|
|||
Downloads:
|
||||
|
||||
* [GitHub](https://github.com/M66B/NetGuard/releases)
|
||||
* [Play store](https://play.google.com/store/apps/details?id=eu.faircode.netguard) (stable)
|
||||
* [Play store](https://play.google.com/apps/testing/eu.faircode.netguard) (beta)
|
||||
* [F-Droid](https://f-droid.org/repository/browse/?fdfilter=netguard&fdid=eu.faircode.netguard) (unsupported, often outdated)
|
||||
|
||||
|
@ -25,6 +26,7 @@ Features
|
|||
* Free of charge
|
||||
* Open source
|
||||
* No extra battery usage
|
||||
* No bandwidth reduction
|
||||
* No calling home
|
||||
* No tracking or analytics
|
||||
* No ads
|
||||
|
@ -125,6 +127,16 @@ No. It cannot even do this, because NetGuard does not even have the *internet* p
|
|||
Internet permission can be granted with each application update without user consent.
|
||||
By showing all applications, NetGuard allows you to block internet access before such an update occurs.
|
||||
|
||||
<a name="FAQ8"></a>
|
||||
**(8) What do I need to enable for Google PlayStore to work?**
|
||||
|
||||
You need 3 things enabled (use search in NetGuard to find them quickly):
|
||||
* com.android.vending
|
||||
* com.google.android.gms
|
||||
* com.android.providers.downloads
|
||||
|
||||
Since Google PlayStore has the tendency to check for updates or even download them all by itself (even if no account is associated) one can keep it in check by enabling _"Allow when device in use"_ for all these 3 apps. Click on the down arrow on the left side of an app name and check the option but leave the network icons alone, leave them red (hence blocked). The little human icon will appear for that app, so you can still open PlayStore and update/install/uninstall apps since it will have internet access, but once you close it, it won't use any bandwidth.
|
||||
|
||||
Support
|
||||
-------
|
||||
|
||||
|
@ -140,10 +152,24 @@ Translations:
|
|||
|
||||
* Translations to other languages are welcomed
|
||||
* Check if the language [is supported by Android](http://stackoverflow.com/questions/7973023/what-is-the-list-of-supported-languages-locales-on-android) and find its locale
|
||||
* Copy [this file](https://github.com/M66B/NetGuard/blob/master/app/src/main/res/values/strings.xml) to the correct locale folder
|
||||
* Copy [this file](https://github.com/M66B/NetGuard/blob/master/app/src/main/res/values/strings.xml) to the [correct locale folder](https://github.com/M66B/NetGuard/blob/master/app/src/main/res/)
|
||||
* Translate the strings in the copied file and omit all lines with **translatable="false"**
|
||||
* Create a [pull request on GitHub](https://help.github.com/articles/using-pull-requests) for the new/updated translation
|
||||
|
||||
Current translations:
|
||||
|
||||
1. Arabic (ar)
|
||||
1. Dutch (nl)
|
||||
1. Simplified Chinese (zh-rCN)
|
||||
1. English
|
||||
1. French (fr)
|
||||
1. German (de)
|
||||
1. Italian (it)
|
||||
1. Korean (ko)
|
||||
1. Romanian (ro)
|
||||
1. Slovak (sk)
|
||||
1. Spanish (es)
|
||||
|
||||
Please note that you agree to the license below by contributing, including the copyright.
|
||||
|
||||
Attribution
|
||||
|
|
|
@ -8,8 +8,8 @@ android {
|
|||
applicationId "eu.faircode.netguard"
|
||||
minSdkVersion 21
|
||||
targetSdkVersion 23
|
||||
versionCode 16
|
||||
versionName "0.16"
|
||||
versionCode 18
|
||||
versionName "0.18"
|
||||
}
|
||||
buildTypes {
|
||||
release {
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
android:label="@string/app_name"
|
||||
android:supportsRtl="true"
|
||||
android:theme="@style/AppTheme">
|
||||
|
||||
<activity
|
||||
android:name=".ActivityMain"
|
||||
android:configChanges="orientation|screenSize"
|
||||
|
@ -24,6 +25,11 @@
|
|||
</intent-filter>
|
||||
</activity>
|
||||
|
||||
<activity
|
||||
android:name=".ActivitySettings"
|
||||
android:configChanges="orientation|screenSize"
|
||||
android:parentActivityName=".ActivityMain" />
|
||||
|
||||
<service
|
||||
android:name=".SinkholeService"
|
||||
android:permission="android.permission.BIND_VPN_SERVICE">
|
||||
|
|
|
@ -49,7 +49,6 @@ import android.support.v7.widget.SearchView;
|
|||
import android.support.v7.widget.SwitchCompat;
|
||||
import android.text.method.LinkMovementMethod;
|
||||
import android.util.Log;
|
||||
import android.util.Xml;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuInflater;
|
||||
|
@ -58,6 +57,7 @@ import android.view.View;
|
|||
import android.widget.Button;
|
||||
import android.widget.CompoundButton;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
|
@ -65,31 +65,19 @@ import com.android.vending.billing.IInAppBillingService;
|
|||
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
import org.xml.sax.Attributes;
|
||||
import org.xml.sax.InputSource;
|
||||
import org.xml.sax.SAXException;
|
||||
import org.xml.sax.XMLReader;
|
||||
import org.xml.sax.helpers.DefaultHandler;
|
||||
import org.xmlpull.v1.XmlSerializer;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.xml.parsers.ParserConfigurationException;
|
||||
import javax.xml.parsers.SAXParserFactory;
|
||||
|
||||
public class ActivityMain extends AppCompatActivity implements SharedPreferences.OnSharedPreferenceChangeListener {
|
||||
private static final String TAG = "NetGuard.Main";
|
||||
|
||||
private boolean running = false;
|
||||
private View actionView;
|
||||
private LinearLayout llIndicators;
|
||||
private ImageView ivInteractive;
|
||||
private ImageView ivNetwork;
|
||||
private ImageView ivMetered;
|
||||
private SwipeRefreshLayout swipeRefresh;
|
||||
private RuleAdapter adapter = null;
|
||||
private MenuItem menuSearch = null;
|
||||
|
@ -100,16 +88,12 @@ public class ActivityMain extends AppCompatActivity implements SharedPreferences
|
|||
|
||||
private static final int REQUEST_VPN = 1;
|
||||
private static final int REQUEST_IAB = 2;
|
||||
private static final int REQUEST_EXPORT = 3;
|
||||
private static final int REQUEST_IMPORT = 4;
|
||||
|
||||
// adb shell pm clear com.android.vending
|
||||
private static final String SKU_DONATE = "donation";
|
||||
// private static final String SKU_DONATE = "android.test.purchased";
|
||||
private static final String ACTION_IAB = "eu.faircode.netguard.IAB";
|
||||
|
||||
private static final Intent INTENT_VPN_SETTINGS = new Intent("android.net.vpn.SETTINGS");
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
Log.i(TAG, "Create");
|
||||
|
@ -123,11 +107,18 @@ public class ActivityMain extends AppCompatActivity implements SharedPreferences
|
|||
running = true;
|
||||
boolean enabled = prefs.getBoolean("enabled", false);
|
||||
|
||||
if (enabled)
|
||||
SinkholeService.start(this);
|
||||
else
|
||||
SinkholeService.stop(this);
|
||||
|
||||
// Action bar
|
||||
actionView = getLayoutInflater().inflate(R.layout.action, null);
|
||||
SwitchCompat swEnabled = (SwitchCompat) actionView.findViewById(R.id.swEnabled);
|
||||
llIndicators = (LinearLayout) actionView.findViewById(R.id.llIndicators);
|
||||
ivInteractive = (ImageView) actionView.findViewById(R.id.ivInteractive);
|
||||
ivNetwork = (ImageView) actionView.findViewById(R.id.ivNetwork);
|
||||
ivMetered = (ImageView) actionView.findViewById(R.id.ivMetered);
|
||||
getSupportActionBar().setDisplayShowCustomEnabled(true);
|
||||
getSupportActionBar().setCustomView(actionView);
|
||||
|
||||
|
@ -154,6 +145,7 @@ public class ActivityMain extends AppCompatActivity implements SharedPreferences
|
|||
if (running) {
|
||||
Log.i(TAG, "Start intent=" + prepare);
|
||||
try {
|
||||
prefs.edit().putBoolean("enabled", true).apply();
|
||||
startActivityForResult(prepare, REQUEST_VPN);
|
||||
} catch (Throwable ex) {
|
||||
Log.e(TAG, ex.toString() + "\n" + Log.getStackTraceString(ex));
|
||||
|
@ -180,6 +172,9 @@ public class ActivityMain extends AppCompatActivity implements SharedPreferences
|
|||
}
|
||||
});
|
||||
|
||||
// Indicators
|
||||
llIndicators.setVisibility(prefs.getBoolean("indicators", false) ? View.VISIBLE : View.GONE);
|
||||
|
||||
// Disabled warning
|
||||
TextView tvDisabled = (TextView) findViewById(R.id.tvDisabled);
|
||||
tvDisabled.setVisibility(enabled ? View.GONE : View.VISIBLE);
|
||||
|
@ -301,6 +296,63 @@ public class ActivityMain extends AppCompatActivity implements SharedPreferences
|
|||
super.onDestroy();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onActivityResult(int requestCode, int resultCode, final Intent data) {
|
||||
Log.i(TAG, "onActivityResult request=" + requestCode + " result=" + requestCode + " ok=" + (resultCode == RESULT_OK));
|
||||
Util.logExtras(TAG, data);
|
||||
|
||||
if (requestCode == REQUEST_VPN) {
|
||||
// Handle VPN approval
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
|
||||
prefs.edit().putBoolean("enabled", resultCode == RESULT_OK).apply();
|
||||
if (resultCode == RESULT_OK)
|
||||
SinkholeService.start(this);
|
||||
|
||||
} else if (requestCode == REQUEST_IAB) {
|
||||
if (resultCode == RESULT_OK) {
|
||||
// Handle donation
|
||||
Intent intent = new Intent(ACTION_IAB);
|
||||
LocalBroadcastManager.getInstance(this).sendBroadcast(intent);
|
||||
} else {
|
||||
int response = (data == null ? -1 : data.getIntExtra("RESPONSE_CODE", -1));
|
||||
Log.i(TAG, "IAB response=" + getIABResult(response));
|
||||
}
|
||||
|
||||
} else {
|
||||
Log.w(TAG, "Unknown activity result request=" + requestCode);
|
||||
super.onActivityResult(requestCode, resultCode, data);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSharedPreferenceChanged(SharedPreferences prefs, String name) {
|
||||
Log.i(TAG, "Preference " + name + "=" + prefs.getAll().get(name));
|
||||
if ("enabled".equals(name)) {
|
||||
// Get enabled
|
||||
boolean enabled = prefs.getBoolean(name, false);
|
||||
|
||||
// Display disabled warning
|
||||
TextView tvDisabled = (TextView) findViewById(R.id.tvDisabled);
|
||||
tvDisabled.setVisibility(enabled ? View.GONE : View.VISIBLE);
|
||||
|
||||
// Check switch state
|
||||
SwitchCompat swEnabled = (SwitchCompat) getSupportActionBar().getCustomView().findViewById(R.id.swEnabled);
|
||||
if (swEnabled.isChecked() != enabled)
|
||||
swEnabled.setChecked(enabled);
|
||||
|
||||
} else if ("whitelist_wifi".equals(name) ||
|
||||
"whitelist_other".equals(name) ||
|
||||
"whitelist_roaming".equals(name) ||
|
||||
"manage_system".equals(name))
|
||||
updateApplicationList();
|
||||
|
||||
else if ("dark_theme".equals(name))
|
||||
recreate();
|
||||
|
||||
else if ("indicators".equals(name))
|
||||
llIndicators.setVisibility(prefs.getBoolean("indicators", false) ? View.VISIBLE : View.GONE);
|
||||
}
|
||||
|
||||
private BroadcastReceiver interactiveStateReceiver = new BroadcastReceiver() {
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
|
@ -319,14 +371,17 @@ public class ActivityMain extends AppCompatActivity implements SharedPreferences
|
|||
Util.logExtras(TAG, intent);
|
||||
|
||||
ivNetwork.setVisibility(View.VISIBLE);
|
||||
ivMetered.setVisibility(View.VISIBLE);
|
||||
|
||||
if (Util.isMetered(context)) {
|
||||
if (Util.isWifiActive(context))
|
||||
ivNetwork.setImageLevel(1);
|
||||
else {
|
||||
if (Util.isRoaming(context))
|
||||
ivNetwork.setImageLevel(3);
|
||||
else
|
||||
ivNetwork.setImageLevel(2);
|
||||
} else
|
||||
ivNetwork.setImageLevel(1);
|
||||
}
|
||||
ivMetered.setImageLevel(Util.isMetered(context) ? 1 : 0);
|
||||
|
||||
actionView.postInvalidate();
|
||||
}
|
||||
|
@ -391,24 +446,6 @@ public class ActivityMain extends AppCompatActivity implements SharedPreferences
|
|||
}.execute();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSharedPreferenceChanged(SharedPreferences prefs, String name) {
|
||||
Log.i(TAG, "Preference " + name + "=" + prefs.getAll().get(name));
|
||||
if ("enabled".equals(name)) {
|
||||
// Get enabled
|
||||
boolean enabled = prefs.getBoolean(name, false);
|
||||
|
||||
// Display disabled warning
|
||||
TextView tvDisabled = (TextView) findViewById(R.id.tvDisabled);
|
||||
tvDisabled.setVisibility(enabled ? View.GONE : View.VISIBLE);
|
||||
|
||||
// Check switch state
|
||||
SwitchCompat swEnabled = (SwitchCompat) getSupportActionBar().getCustomView().findViewById(R.id.swEnabled);
|
||||
if (swEnabled.isChecked() != enabled)
|
||||
swEnabled.setChecked(enabled);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
MenuInflater inflater = getMenuInflater();
|
||||
|
@ -441,24 +478,9 @@ public class ActivityMain extends AppCompatActivity implements SharedPreferences
|
|||
}
|
||||
});
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onPrepareOptionsMenu(Menu menu) {
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
|
||||
|
||||
menu.findItem(R.id.menu_whitelist_wifi).setChecked(prefs.getBoolean("whitelist_wifi", true));
|
||||
menu.findItem(R.id.menu_whitelist_other).setChecked(prefs.getBoolean("whitelist_other", true));
|
||||
menu.findItem(R.id.menu_whitelist_roaming).setChecked(prefs.getBoolean("whitelist_roaming", true));
|
||||
menu.findItem(R.id.menu_system).setChecked(prefs.getBoolean("manage_system", false));
|
||||
menu.findItem(R.id.menu_export).setEnabled(getIntentCreateDocument().resolveActivity(getPackageManager()) != null);
|
||||
menu.findItem(R.id.menu_import).setEnabled(getIntentOpenDocument().resolveActivity(getPackageManager()) != null);
|
||||
menu.findItem(R.id.menu_theme).setChecked(prefs.getBoolean("dark_theme", false));
|
||||
menu.findItem(R.id.menu_vpn_settings).setEnabled(INTENT_VPN_SETTINGS.resolveActivity(getPackageManager()) != null);
|
||||
menu.findItem(R.id.menu_support).setEnabled(getIntentSupport().resolveActivity(getPackageManager()) != null);
|
||||
|
||||
return super.onPrepareOptionsMenu(menu);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -467,36 +489,8 @@ public class ActivityMain extends AppCompatActivity implements SharedPreferences
|
|||
|
||||
// Handle item selection
|
||||
switch (item.getItemId()) {
|
||||
case R.id.menu_whitelist_wifi:
|
||||
menu_whitelist_wifi(prefs);
|
||||
return true;
|
||||
|
||||
case R.id.menu_whitelist_other:
|
||||
menu_whitelist_other(prefs);
|
||||
return true;
|
||||
|
||||
case R.id.menu_whitelist_roaming:
|
||||
menu_whitelist_roaming(prefs);
|
||||
return true;
|
||||
|
||||
case R.id.menu_system:
|
||||
menu_system(prefs);
|
||||
return true;
|
||||
|
||||
case R.id.menu_export:
|
||||
startActivityForResult(getIntentCreateDocument(), REQUEST_EXPORT);
|
||||
return true;
|
||||
|
||||
case R.id.menu_import:
|
||||
startActivityForResult(getIntentOpenDocument(), REQUEST_IMPORT);
|
||||
return true;
|
||||
|
||||
case R.id.menu_theme:
|
||||
menu_theme(prefs);
|
||||
return true;
|
||||
|
||||
case R.id.menu_vpn_settings:
|
||||
startActivity(INTENT_VPN_SETTINGS);
|
||||
case R.id.menu_settings:
|
||||
startActivity(new Intent(this, ActivitySettings.class));
|
||||
return true;
|
||||
|
||||
case R.id.menu_support:
|
||||
|
@ -512,35 +506,6 @@ public class ActivityMain extends AppCompatActivity implements SharedPreferences
|
|||
}
|
||||
}
|
||||
|
||||
private void menu_whitelist_wifi(SharedPreferences prefs) {
|
||||
prefs.edit().putBoolean("whitelist_wifi", !prefs.getBoolean("whitelist_wifi", true)).apply();
|
||||
updateApplicationList();
|
||||
SinkholeService.reload("wifi", this);
|
||||
}
|
||||
|
||||
private void menu_whitelist_other(SharedPreferences prefs) {
|
||||
prefs.edit().putBoolean("whitelist_other", !prefs.getBoolean("whitelist_other", true)).apply();
|
||||
updateApplicationList();
|
||||
SinkholeService.reload("other", this);
|
||||
}
|
||||
|
||||
private void menu_whitelist_roaming(SharedPreferences prefs) {
|
||||
prefs.edit().putBoolean("whitelist_roaming", !prefs.getBoolean("whitelist_roaming", true)).apply();
|
||||
updateApplicationList();
|
||||
SinkholeService.reload("other", this);
|
||||
}
|
||||
|
||||
private void menu_system(SharedPreferences prefs) {
|
||||
prefs.edit().putBoolean("manage_system", !prefs.getBoolean("manage_system", false)).apply();
|
||||
updateApplicationList();
|
||||
SinkholeService.reload(null, this);
|
||||
}
|
||||
|
||||
private void menu_theme(SharedPreferences prefs) {
|
||||
prefs.edit().putBoolean("dark_theme", !prefs.getBoolean("dark_theme", false)).apply();
|
||||
recreate();
|
||||
}
|
||||
|
||||
private void menu_about() {
|
||||
// Create view
|
||||
LayoutInflater inflater = LayoutInflater.from(this);
|
||||
|
@ -663,133 +628,12 @@ public class ActivityMain extends AppCompatActivity implements SharedPreferences
|
|||
}.execute();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onActivityResult(int requestCode, int resultCode, final Intent data) {
|
||||
Log.i(TAG, "onActivityResult request=" + requestCode + " result=" + requestCode + " ok=" + (resultCode == RESULT_OK));
|
||||
Util.logExtras(TAG, data);
|
||||
|
||||
if (requestCode == REQUEST_VPN) {
|
||||
// Update enabled state
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
|
||||
prefs.edit().putBoolean("enabled", resultCode == RESULT_OK).apply();
|
||||
|
||||
// Start service
|
||||
if (resultCode == RESULT_OK)
|
||||
SinkholeService.start(this);
|
||||
|
||||
} else if (requestCode == REQUEST_IAB) {
|
||||
if (resultCode == RESULT_OK) {
|
||||
// Handle donation
|
||||
Intent intent = new Intent(ACTION_IAB);
|
||||
LocalBroadcastManager.getInstance(this).sendBroadcast(intent);
|
||||
} else {
|
||||
int response = (data == null ? -1 : data.getIntExtra("RESPONSE_CODE", -1));
|
||||
Log.i(TAG, "IAB response=" + getIABResult(response));
|
||||
}
|
||||
|
||||
} else if (requestCode == REQUEST_EXPORT) {
|
||||
if (resultCode == RESULT_OK && data != null)
|
||||
handleExport(data);
|
||||
|
||||
} else if (requestCode == REQUEST_IMPORT) {
|
||||
if (resultCode == RESULT_OK && data != null)
|
||||
handleImport(data);
|
||||
|
||||
} else {
|
||||
Log.w(TAG, "Unknown activity result request=" + requestCode);
|
||||
super.onActivityResult(requestCode, resultCode, data);
|
||||
}
|
||||
}
|
||||
|
||||
private void handleExport(final Intent data) {
|
||||
new AsyncTask<Object, Object, Throwable>() {
|
||||
@Override
|
||||
protected Throwable doInBackground(Object... objects) {
|
||||
OutputStream out = null;
|
||||
try {
|
||||
out = getContentResolver().openOutputStream(data.getData());
|
||||
Log.i(TAG, "Writing URI=" + data.getData());
|
||||
xmlExport(out);
|
||||
return null;
|
||||
} catch (Throwable ex) {
|
||||
Log.e(TAG, ex.toString() + "\n" + Log.getStackTraceString(ex));
|
||||
return ex;
|
||||
} finally {
|
||||
if (out != null)
|
||||
try {
|
||||
out.close();
|
||||
} catch (IOException ex) {
|
||||
Log.e(TAG, ex.toString() + "\n" + Log.getStackTraceString(ex));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPostExecute(Throwable ex) {
|
||||
if (ex == null)
|
||||
Toast.makeText(ActivityMain.this, R.string.msg_completed, Toast.LENGTH_LONG).show();
|
||||
else
|
||||
Toast.makeText(ActivityMain.this, ex.toString(), Toast.LENGTH_LONG).show();
|
||||
}
|
||||
}.execute();
|
||||
}
|
||||
|
||||
private void handleImport(final Intent data) {
|
||||
new AsyncTask<Object, Object, Throwable>() {
|
||||
@Override
|
||||
protected Throwable doInBackground(Object... objects) {
|
||||
InputStream in = null;
|
||||
try {
|
||||
in = getContentResolver().openInputStream(data.getData());
|
||||
Log.i(TAG, "Reading URI=" + data.getData());
|
||||
xmlImport(in);
|
||||
return null;
|
||||
} catch (Throwable ex) {
|
||||
Log.e(TAG, ex.toString() + "\n" + Log.getStackTraceString(ex));
|
||||
return ex;
|
||||
} finally {
|
||||
if (in != null)
|
||||
try {
|
||||
in.close();
|
||||
} catch (IOException ex) {
|
||||
Log.e(TAG, ex.toString() + "\n" + Log.getStackTraceString(ex));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPostExecute(Throwable ex) {
|
||||
if (ex == null) {
|
||||
SinkholeService.reload(null, ActivityMain.this);
|
||||
recreate();
|
||||
Toast.makeText(ActivityMain.this, R.string.msg_completed, Toast.LENGTH_LONG).show();
|
||||
} else
|
||||
Toast.makeText(ActivityMain.this, ex.toString(), Toast.LENGTH_LONG).show();
|
||||
}
|
||||
}.execute();
|
||||
}
|
||||
|
||||
private static Intent getIntentSupport() {
|
||||
Intent intent = new Intent(Intent.ACTION_VIEW);
|
||||
intent.setData(Uri.parse("http://forum.xda-developers.com/showthread.php?t=3233012"));
|
||||
return intent;
|
||||
}
|
||||
|
||||
private static Intent getIntentCreateDocument() {
|
||||
Intent intent = new Intent(Intent.ACTION_CREATE_DOCUMENT);
|
||||
intent.addCategory(Intent.CATEGORY_OPENABLE);
|
||||
intent.setType("text/xml");
|
||||
intent.putExtra(Intent.EXTRA_TITLE, "netguard.xml");
|
||||
return intent;
|
||||
}
|
||||
|
||||
private static Intent getIntentOpenDocument() {
|
||||
Intent intent = new Intent(Intent.ACTION_OPEN_DOCUMENT);
|
||||
intent.addCategory(Intent.CATEGORY_OPENABLE);
|
||||
intent.setType("text/xml");
|
||||
return intent;
|
||||
}
|
||||
|
||||
private static boolean IABisAvailable(String sku, IInAppBillingService service, Context context) throws RemoteException, JSONException {
|
||||
ArrayList<String> skuList = new ArrayList<>();
|
||||
skuList.add(sku);
|
||||
|
@ -870,119 +714,4 @@ public class ActivityMain extends AppCompatActivity implements SharedPreferences
|
|||
return Integer.toString(responseCode);
|
||||
}
|
||||
}
|
||||
|
||||
private void xmlExport(OutputStream out) throws IOException {
|
||||
XmlSerializer serializer = Xml.newSerializer();
|
||||
serializer.setOutput(out, "UTF-8");
|
||||
serializer.startDocument(null, true);
|
||||
serializer.setFeature("http://xmlpull.org/v1/doc/features.html#indent-output", true);
|
||||
serializer.startTag(null, "netguard");
|
||||
|
||||
serializer.startTag(null, "application");
|
||||
xmlExport(PreferenceManager.getDefaultSharedPreferences(this), serializer);
|
||||
serializer.endTag(null, "application");
|
||||
|
||||
serializer.startTag(null, "wifi");
|
||||
xmlExport(getSharedPreferences("wifi", Context.MODE_PRIVATE), serializer);
|
||||
serializer.endTag(null, "wifi");
|
||||
|
||||
serializer.startTag(null, "mobile");
|
||||
xmlExport(getSharedPreferences("other", Context.MODE_PRIVATE), serializer);
|
||||
serializer.endTag(null, "mobile");
|
||||
|
||||
serializer.startTag(null, "unused");
|
||||
xmlExport(getSharedPreferences("unused", Context.MODE_PRIVATE), serializer);
|
||||
serializer.endTag(null, "unused");
|
||||
|
||||
serializer.endTag(null, "netguard");
|
||||
serializer.endDocument();
|
||||
serializer.flush();
|
||||
}
|
||||
|
||||
private void xmlExport(SharedPreferences prefs, XmlSerializer serializer) throws IOException {
|
||||
Map<String, ?> settings = prefs.getAll();
|
||||
for (String key : settings.keySet()) {
|
||||
Object value = settings.get(key);
|
||||
if (value instanceof Boolean) {
|
||||
serializer.startTag(null, "setting");
|
||||
serializer.attribute(null, "key", key);
|
||||
serializer.attribute(null, "type", "boolean");
|
||||
serializer.attribute(null, "value", value.toString());
|
||||
serializer.endTag(null, "setting");
|
||||
} else
|
||||
Log.e(TAG, "Unknown key=" + key);
|
||||
}
|
||||
}
|
||||
|
||||
private void xmlImport(InputStream in) throws IOException, SAXException, ParserConfigurationException {
|
||||
XMLReader reader = SAXParserFactory.newInstance().newSAXParser().getXMLReader();
|
||||
XmlImportHandler handler = new XmlImportHandler();
|
||||
reader.setContentHandler(handler);
|
||||
reader.parse(new InputSource(in));
|
||||
|
||||
xmlImport(handler.application, PreferenceManager.getDefaultSharedPreferences(this));
|
||||
xmlImport(handler.wifi, getSharedPreferences("wifi", Context.MODE_PRIVATE));
|
||||
xmlImport(handler.mobile, getSharedPreferences("other", Context.MODE_PRIVATE));
|
||||
xmlImport(handler.unused, getSharedPreferences("unused", Context.MODE_PRIVATE));
|
||||
}
|
||||
|
||||
private void xmlImport(Map<String, Object> settings, SharedPreferences prefs) {
|
||||
SharedPreferences.Editor editor = prefs.edit();
|
||||
|
||||
for (String key : prefs.getAll().keySet())
|
||||
editor.remove(key);
|
||||
|
||||
for (String key : settings.keySet()) {
|
||||
Object value = settings.get(key);
|
||||
if (value instanceof Boolean)
|
||||
editor.putBoolean(key, (Boolean) value);
|
||||
else
|
||||
Log.e(TAG, "Unknown type=" + value.getClass());
|
||||
}
|
||||
|
||||
editor.apply();
|
||||
}
|
||||
|
||||
private class XmlImportHandler extends DefaultHandler {
|
||||
public Map<String, Object> application = new HashMap<>();
|
||||
public Map<String, Object> wifi = new HashMap<>();
|
||||
public Map<String, Object> mobile = new HashMap<>();
|
||||
public Map<String, Object> unused = new HashMap<>();
|
||||
private Map<String, Object> current = null;
|
||||
|
||||
@Override
|
||||
public void startElement(String uri, String localName, String qName, Attributes attributes) {
|
||||
if (qName.equals("netguard"))
|
||||
; // Ignore
|
||||
|
||||
else if (qName.equals("application"))
|
||||
current = application;
|
||||
|
||||
else if (qName.equals("wifi"))
|
||||
current = wifi;
|
||||
|
||||
else if (qName.equals("mobile"))
|
||||
current = mobile;
|
||||
|
||||
else if (qName.equals("unused"))
|
||||
current = unused;
|
||||
|
||||
else if (qName.equals("setting")) {
|
||||
String key = attributes.getValue("key");
|
||||
String type = attributes.getValue("type");
|
||||
String value = attributes.getValue("value");
|
||||
|
||||
if (current == null)
|
||||
Log.e(TAG, "No current key=" + key);
|
||||
else {
|
||||
if ("boolean".equals(type))
|
||||
current.put(key, Boolean.parseBoolean(value));
|
||||
else
|
||||
Log.e(TAG, "Unknown type key=" + key);
|
||||
}
|
||||
|
||||
} else
|
||||
Log.e(TAG, "Unknown element qname=" + qName);
|
||||
}
|
||||
}
|
||||
}
|
289
app/src/main/java/eu/faircode/netguard/ActivitySettings.java
Normal file
|
@ -0,0 +1,289 @@
|
|||
package eu.faircode.netguard;
|
||||
|
||||
/*
|
||||
This file is part of NetGuard.
|
||||
|
||||
NetGuard is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
NetGuard is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with NetGuard. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Copyright 2015 by Marcel Bokhorst (M66B)
|
||||
*/
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Bundle;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.util.Log;
|
||||
import android.util.Xml;
|
||||
import android.widget.Toast;
|
||||
|
||||
import org.xml.sax.Attributes;
|
||||
import org.xml.sax.InputSource;
|
||||
import org.xml.sax.SAXException;
|
||||
import org.xml.sax.XMLReader;
|
||||
import org.xml.sax.helpers.DefaultHandler;
|
||||
import org.xmlpull.v1.XmlSerializer;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.xml.parsers.ParserConfigurationException;
|
||||
import javax.xml.parsers.SAXParserFactory;
|
||||
|
||||
public class ActivitySettings extends AppCompatActivity implements SharedPreferences.OnSharedPreferenceChangeListener {
|
||||
private static final String TAG = "NetGuard.Settings";
|
||||
|
||||
public static final int REQUEST_EXPORT = 1;
|
||||
public static final int REQUEST_IMPORT = 2;
|
||||
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
|
||||
setTheme(prefs.getBoolean("dark_theme", false) ? R.style.AppThemeDark : R.style.AppTheme);
|
||||
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
getFragmentManager().beginTransaction().replace(android.R.id.content, new FragmentSettings()).commit();
|
||||
|
||||
PreferenceManager.getDefaultSharedPreferences(this).registerOnSharedPreferenceChangeListener(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
PreferenceManager.getDefaultSharedPreferences(this).unregisterOnSharedPreferenceChangeListener(this);
|
||||
super.onDestroy();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSharedPreferenceChanged(SharedPreferences prefs, String name) {
|
||||
if ("whitelist_wifi".equals(name))
|
||||
SinkholeService.reload("wifi", this);
|
||||
|
||||
else if ("whitelist_other".equals(name))
|
||||
SinkholeService.reload("other", this);
|
||||
|
||||
else if ("whitelist_roaming".equals(name))
|
||||
SinkholeService.reload("other", this);
|
||||
|
||||
else if ("manage_system".equals(name))
|
||||
SinkholeService.reload(null, this);
|
||||
|
||||
else if ("dark_theme".equals(name))
|
||||
recreate();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onActivityResult(int requestCode, int resultCode, final Intent data) {
|
||||
Log.i(TAG, "onActivityResult request=" + requestCode + " result=" + requestCode + " ok=" + (resultCode == RESULT_OK));
|
||||
if (requestCode == REQUEST_EXPORT) {
|
||||
if (resultCode == RESULT_OK && data != null)
|
||||
handleExport(data);
|
||||
|
||||
} else if (requestCode == REQUEST_IMPORT) {
|
||||
if (resultCode == RESULT_OK && data != null)
|
||||
handleImport(data);
|
||||
|
||||
} else {
|
||||
Log.w(TAG, "Unknown activity result request=" + requestCode);
|
||||
super.onActivityResult(requestCode, resultCode, data);
|
||||
}
|
||||
}
|
||||
|
||||
private void handleExport(final Intent data) {
|
||||
new AsyncTask<Object, Object, Throwable>() {
|
||||
@Override
|
||||
protected Throwable doInBackground(Object... objects) {
|
||||
OutputStream out = null;
|
||||
try {
|
||||
out = getContentResolver().openOutputStream(data.getData());
|
||||
Log.i(TAG, "Writing URI=" + data.getData());
|
||||
xmlExport(out);
|
||||
return null;
|
||||
} catch (Throwable ex) {
|
||||
Log.e(TAG, ex.toString() + "\n" + Log.getStackTraceString(ex));
|
||||
return ex;
|
||||
} finally {
|
||||
if (out != null)
|
||||
try {
|
||||
out.close();
|
||||
} catch (IOException ex) {
|
||||
Log.e(TAG, ex.toString() + "\n" + Log.getStackTraceString(ex));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPostExecute(Throwable ex) {
|
||||
if (ex == null)
|
||||
Toast.makeText(ActivitySettings.this, R.string.msg_completed, Toast.LENGTH_LONG).show();
|
||||
else
|
||||
Toast.makeText(ActivitySettings.this, ex.toString(), Toast.LENGTH_LONG).show();
|
||||
}
|
||||
}.execute();
|
||||
}
|
||||
|
||||
private void handleImport(final Intent data) {
|
||||
new AsyncTask<Object, Object, Throwable>() {
|
||||
@Override
|
||||
protected Throwable doInBackground(Object... objects) {
|
||||
InputStream in = null;
|
||||
try {
|
||||
in = getContentResolver().openInputStream(data.getData());
|
||||
Log.i(TAG, "Reading URI=" + data.getData());
|
||||
xmlImport(in);
|
||||
return null;
|
||||
} catch (Throwable ex) {
|
||||
Log.e(TAG, ex.toString() + "\n" + Log.getStackTraceString(ex));
|
||||
return ex;
|
||||
} finally {
|
||||
if (in != null)
|
||||
try {
|
||||
in.close();
|
||||
} catch (IOException ex) {
|
||||
Log.e(TAG, ex.toString() + "\n" + Log.getStackTraceString(ex));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPostExecute(Throwable ex) {
|
||||
if (ex == null) {
|
||||
SinkholeService.reload(null, ActivitySettings.this);
|
||||
recreate();
|
||||
Toast.makeText(ActivitySettings.this, R.string.msg_completed, Toast.LENGTH_LONG).show();
|
||||
} else
|
||||
Toast.makeText(ActivitySettings.this, ex.toString(), Toast.LENGTH_LONG).show();
|
||||
}
|
||||
}.execute();
|
||||
}
|
||||
|
||||
private void xmlExport(OutputStream out) throws IOException {
|
||||
XmlSerializer serializer = Xml.newSerializer();
|
||||
serializer.setOutput(out, "UTF-8");
|
||||
serializer.startDocument(null, true);
|
||||
serializer.setFeature("http://xmlpull.org/v1/doc/features.html#indent-output", true);
|
||||
serializer.startTag(null, "netguard");
|
||||
|
||||
serializer.startTag(null, "application");
|
||||
xmlExport(PreferenceManager.getDefaultSharedPreferences(this), serializer);
|
||||
serializer.endTag(null, "application");
|
||||
|
||||
serializer.startTag(null, "wifi");
|
||||
xmlExport(getSharedPreferences("wifi", Context.MODE_PRIVATE), serializer);
|
||||
serializer.endTag(null, "wifi");
|
||||
|
||||
serializer.startTag(null, "mobile");
|
||||
xmlExport(getSharedPreferences("other", Context.MODE_PRIVATE), serializer);
|
||||
serializer.endTag(null, "mobile");
|
||||
|
||||
serializer.startTag(null, "unused");
|
||||
xmlExport(getSharedPreferences("unused", Context.MODE_PRIVATE), serializer);
|
||||
serializer.endTag(null, "unused");
|
||||
|
||||
serializer.endTag(null, "netguard");
|
||||
serializer.endDocument();
|
||||
serializer.flush();
|
||||
}
|
||||
|
||||
private void xmlExport(SharedPreferences prefs, XmlSerializer serializer) throws IOException {
|
||||
Map<String, ?> settings = prefs.getAll();
|
||||
for (String key : settings.keySet()) {
|
||||
Object value = settings.get(key);
|
||||
if (value instanceof Boolean) {
|
||||
serializer.startTag(null, "setting");
|
||||
serializer.attribute(null, "key", key);
|
||||
serializer.attribute(null, "type", "boolean");
|
||||
serializer.attribute(null, "value", value.toString());
|
||||
serializer.endTag(null, "setting");
|
||||
} else
|
||||
Log.e(TAG, "Unknown key=" + key);
|
||||
}
|
||||
}
|
||||
|
||||
private void xmlImport(InputStream in) throws IOException, SAXException, ParserConfigurationException {
|
||||
XMLReader reader = SAXParserFactory.newInstance().newSAXParser().getXMLReader();
|
||||
XmlImportHandler handler = new XmlImportHandler();
|
||||
reader.setContentHandler(handler);
|
||||
reader.parse(new InputSource(in));
|
||||
|
||||
xmlImport(handler.application, PreferenceManager.getDefaultSharedPreferences(this));
|
||||
xmlImport(handler.wifi, getSharedPreferences("wifi", Context.MODE_PRIVATE));
|
||||
xmlImport(handler.mobile, getSharedPreferences("other", Context.MODE_PRIVATE));
|
||||
xmlImport(handler.unused, getSharedPreferences("unused", Context.MODE_PRIVATE));
|
||||
}
|
||||
|
||||
private void xmlImport(Map<String, Object> settings, SharedPreferences prefs) {
|
||||
SharedPreferences.Editor editor = prefs.edit();
|
||||
|
||||
for (String key : prefs.getAll().keySet())
|
||||
editor.remove(key);
|
||||
|
||||
for (String key : settings.keySet()) {
|
||||
Object value = settings.get(key);
|
||||
if (value instanceof Boolean)
|
||||
editor.putBoolean(key, (Boolean) value);
|
||||
else
|
||||
Log.e(TAG, "Unknown type=" + value.getClass());
|
||||
}
|
||||
|
||||
editor.apply();
|
||||
}
|
||||
|
||||
private class XmlImportHandler extends DefaultHandler {
|
||||
public Map<String, Object> application = new HashMap<>();
|
||||
public Map<String, Object> wifi = new HashMap<>();
|
||||
public Map<String, Object> mobile = new HashMap<>();
|
||||
public Map<String, Object> unused = new HashMap<>();
|
||||
private Map<String, Object> current = null;
|
||||
|
||||
@Override
|
||||
public void startElement(String uri, String localName, String qName, Attributes attributes) {
|
||||
if (qName.equals("netguard"))
|
||||
; // Ignore
|
||||
|
||||
else if (qName.equals("application"))
|
||||
current = application;
|
||||
|
||||
else if (qName.equals("wifi"))
|
||||
current = wifi;
|
||||
|
||||
else if (qName.equals("mobile"))
|
||||
current = mobile;
|
||||
|
||||
else if (qName.equals("unused"))
|
||||
current = unused;
|
||||
|
||||
else if (qName.equals("setting")) {
|
||||
String key = attributes.getValue("key");
|
||||
String type = attributes.getValue("type");
|
||||
String value = attributes.getValue("value");
|
||||
|
||||
if (current == null)
|
||||
Log.e(TAG, "No current key=" + key);
|
||||
else {
|
||||
if ("boolean".equals(type))
|
||||
current.put(key, Boolean.parseBoolean(value));
|
||||
else
|
||||
Log.e(TAG, "Unknown type key=" + key);
|
||||
}
|
||||
|
||||
} else
|
||||
Log.e(TAG, "Unknown element qname=" + qName);
|
||||
}
|
||||
}
|
||||
}
|
75
app/src/main/java/eu/faircode/netguard/FragmentSettings.java
Normal file
|
@ -0,0 +1,75 @@
|
|||
package eu.faircode.netguard;
|
||||
|
||||
/*
|
||||
This file is part of NetGuard.
|
||||
|
||||
NetGuard is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
NetGuard is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with NetGuard. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Copyright 2015 by Marcel Bokhorst (M66B)
|
||||
*/
|
||||
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.preference.Preference;
|
||||
import android.preference.PreferenceFragment;
|
||||
|
||||
public class FragmentSettings extends PreferenceFragment {
|
||||
private static final Intent INTENT_VPN_SETTINGS = new Intent("android.net.vpn.SETTINGS");
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
addPreferencesFromResource(R.xml.preferences);
|
||||
|
||||
Preference pref_export = getPreferenceScreen().findPreference("export");
|
||||
pref_export.setEnabled(getIntentCreateDocument().resolveActivity(getActivity().getPackageManager()) != null);
|
||||
pref_export.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
|
||||
@Override
|
||||
public boolean onPreferenceClick(Preference preference) {
|
||||
getActivity().startActivityForResult(getIntentCreateDocument(), ActivitySettings.REQUEST_EXPORT);
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
Preference pref_import = getPreferenceScreen().findPreference("import");
|
||||
pref_import.setEnabled(getIntentCreateDocument().resolveActivity(getActivity().getPackageManager()) != null);
|
||||
pref_import.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
|
||||
@Override
|
||||
public boolean onPreferenceClick(Preference preference) {
|
||||
getActivity().startActivityForResult(getIntentOpenDocument(), ActivitySettings.REQUEST_IMPORT);
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
Preference pref_vpn = getPreferenceScreen().findPreference("vpn");
|
||||
pref_vpn.setEnabled(INTENT_VPN_SETTINGS.resolveActivity(getActivity().getPackageManager()) != null);
|
||||
pref_vpn.setIntent(INTENT_VPN_SETTINGS);
|
||||
}
|
||||
|
||||
|
||||
private static Intent getIntentCreateDocument() {
|
||||
Intent intent = new Intent(Intent.ACTION_CREATE_DOCUMENT);
|
||||
intent.addCategory(Intent.CATEGORY_OPENABLE);
|
||||
intent.setType("text/xml");
|
||||
intent.putExtra(Intent.EXTRA_TITLE, "netguard.xml");
|
||||
return intent;
|
||||
}
|
||||
|
||||
private static Intent getIntentOpenDocument() {
|
||||
Intent intent = new Intent(Intent.ACTION_OPEN_DOCUMENT);
|
||||
intent.addCategory(Intent.CATEGORY_OPENABLE);
|
||||
intent.setType("text/xml");
|
||||
return intent;
|
||||
}
|
||||
}
|
|
@ -22,7 +22,9 @@ package eu.faircode.netguard;
|
|||
import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.net.VpnService;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.util.Log;
|
||||
|
||||
public class Receiver extends BroadcastReceiver {
|
||||
|
@ -46,8 +48,10 @@ public class Receiver extends BroadcastReceiver {
|
|||
|
||||
} else {
|
||||
// Start service
|
||||
if (VpnService.prepare(context) == null)
|
||||
SinkholeService.start(context);
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
||||
if (prefs.getBoolean("enabled", false))
|
||||
if (VpnService.prepare(context) == null)
|
||||
SinkholeService.start(context);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -19,7 +19,7 @@ package eu.faircode.netguard;
|
|||
Copyright 2015 by Marcel Bokhorst (M66B)
|
||||
*/
|
||||
|
||||
import android.app.NotificationManager;
|
||||
import android.app.Notification;
|
||||
import android.app.PendingIntent;
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
|
@ -32,6 +32,8 @@ import android.net.VpnService;
|
|||
import android.os.ParcelFileDescriptor;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.support.v4.app.NotificationCompat;
|
||||
import android.support.v4.app.NotificationManagerCompat;
|
||||
import android.support.v4.content.ContextCompat;
|
||||
import android.util.Log;
|
||||
import android.widget.Toast;
|
||||
|
||||
|
@ -50,28 +52,36 @@ public class SinkholeService extends VpnService {
|
|||
private Thread thread = null;
|
||||
|
||||
private static final int NOTIFY_DISABLED = 1;
|
||||
|
||||
private static final String EXTRA_COMMAND = "Command";
|
||||
private static final String EXTRA_UPDATE = "Update";
|
||||
|
||||
private enum Command {start, reload, stop}
|
||||
|
||||
@Override
|
||||
public int onStartCommand(Intent intent, int flags, int startId) {
|
||||
// Get enabled
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
|
||||
final boolean enabled = prefs.getBoolean("enabled", false);
|
||||
final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(SinkholeService.this);
|
||||
|
||||
// Get command
|
||||
final Command cmd = (intent == null ? Command.start : (Command) intent.getSerializableExtra(EXTRA_COMMAND));
|
||||
Log.i(TAG, "Start intent=" + intent + " command=" + cmd + " enabled=" + enabled + " vpn=" + (vpn != null));
|
||||
Log.i(TAG, "Start intent=" + intent + " command=" + cmd + " vpn=" + (vpn != null));
|
||||
|
||||
// Update enabled state
|
||||
if (intent != null && intent.getBooleanExtra(EXTRA_UPDATE, false))
|
||||
if (cmd == Command.start)
|
||||
prefs.edit().putBoolean("enabled", true).apply();
|
||||
else if (cmd == Command.stop)
|
||||
prefs.edit().putBoolean("enabled", false).apply();
|
||||
|
||||
// Process command
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
synchronized (SinkholeService.this) {
|
||||
Log.i(TAG, "Executing command=" + cmd + " vpn=" + (vpn != null));
|
||||
switch (cmd) {
|
||||
case start:
|
||||
if (enabled && vpn == null) {
|
||||
if (vpn == null) {
|
||||
last_roaming = Util.isRoaming(SinkholeService.this);
|
||||
vpn = startVPN();
|
||||
startDebug(vpn);
|
||||
|
@ -82,11 +92,9 @@ public class SinkholeService extends VpnService {
|
|||
case reload:
|
||||
// Seamless handover
|
||||
ParcelFileDescriptor prev = vpn;
|
||||
if (enabled) {
|
||||
vpn = startVPN();
|
||||
stopDebug();
|
||||
startDebug(vpn);
|
||||
}
|
||||
vpn = startVPN();
|
||||
stopDebug();
|
||||
startDebug(vpn);
|
||||
if (prev != null)
|
||||
stopVPN(prev);
|
||||
break;
|
||||
|
@ -347,19 +355,20 @@ public class SinkholeService extends VpnService {
|
|||
PendingIntent piMain = PendingIntent.getActivity(this, 0, riMain, PendingIntent.FLAG_CANCEL_CURRENT);
|
||||
|
||||
NotificationCompat.Builder notification = new NotificationCompat.Builder(this)
|
||||
.setSmallIcon(R.mipmap.ic_launcher)
|
||||
.setSmallIcon(R.drawable.ic_security_white_24dp)
|
||||
.setContentTitle(getString(R.string.app_name))
|
||||
.setContentText(getString(R.string.msg_revoked))
|
||||
.setContentIntent(piMain)
|
||||
.setCategory(Notification.CATEGORY_STATUS)
|
||||
.setVisibility(Notification.VISIBILITY_SECRET)
|
||||
.setColor(ContextCompat.getColor(this, R.color.colorAccent))
|
||||
.setAutoCancel(true);
|
||||
|
||||
NotificationManager nm = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
|
||||
nm.notify(NOTIFY_DISABLED, notification.build());
|
||||
NotificationManagerCompat.from(this).notify(NOTIFY_DISABLED, notification.build());
|
||||
}
|
||||
|
||||
private void removeDisabledNotification() {
|
||||
NotificationManager nm = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
|
||||
nm.cancel(NOTIFY_DISABLED);
|
||||
NotificationManagerCompat.from(this).cancel(NOTIFY_DISABLED);
|
||||
}
|
||||
|
||||
public static void start(Context context) {
|
||||
|
@ -369,11 +378,13 @@ public class SinkholeService extends VpnService {
|
|||
}
|
||||
|
||||
public static void reload(String network, Context context) {
|
||||
if (network == null || ("wifi".equals(network) ? !Util.isMetered(context) : Util.isMetered(context))) {
|
||||
Intent intent = new Intent(context, SinkholeService.class);
|
||||
intent.putExtra(EXTRA_COMMAND, Command.reload);
|
||||
context.startService(intent);
|
||||
}
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
||||
if (prefs.getBoolean("enabled", false))
|
||||
if (network == null || ("wifi".equals(network) ? !Util.isMetered(context) : Util.isMetered(context))) {
|
||||
Intent intent = new Intent(context, SinkholeService.class);
|
||||
intent.putExtra(EXTRA_COMMAND, Command.reload);
|
||||
context.startService(intent);
|
||||
}
|
||||
}
|
||||
|
||||
public static void stop(Context context) {
|
||||
|
|
BIN
app/src/main/res/drawable-hdpi/ic_attach_money_white_24dp.png
Normal file
After Width: | Height: | Size: 397 B |
BIN
app/src/main/res/drawable-hdpi/ic_money_off_white_24dp.png
Normal file
After Width: | Height: | Size: 366 B |
BIN
app/src/main/res/drawable-hdpi/ic_security_white_24dp.png
Normal file
After Width: | Height: | Size: 428 B |
BIN
app/src/main/res/drawable-mdpi/ic_attach_money_white_24dp.png
Normal file
After Width: | Height: | Size: 256 B |
BIN
app/src/main/res/drawable-mdpi/ic_money_off_white_24dp.png
Normal file
After Width: | Height: | Size: 255 B |
BIN
app/src/main/res/drawable-mdpi/ic_security_white_24dp.png
Normal file
After Width: | Height: | Size: 288 B |
BIN
app/src/main/res/drawable-xhdpi/ic_attach_money_white_24dp.png
Normal file
After Width: | Height: | Size: 448 B |
BIN
app/src/main/res/drawable-xhdpi/ic_money_off_white_24dp.png
Normal file
After Width: | Height: | Size: 428 B |
BIN
app/src/main/res/drawable-xhdpi/ic_security_white_24dp.png
Normal file
After Width: | Height: | Size: 507 B |
BIN
app/src/main/res/drawable-xxhdpi/ic_attach_money_white_24dp.png
Normal file
After Width: | Height: | Size: 640 B |
BIN
app/src/main/res/drawable-xxhdpi/ic_money_off_white_24dp.png
Normal file
After Width: | Height: | Size: 607 B |
BIN
app/src/main/res/drawable-xxhdpi/ic_security_white_24dp.png
Normal file
After Width: | Height: | Size: 702 B |
BIN
app/src/main/res/drawable-xxxhdpi/ic_attach_money_white_24dp.png
Normal file
After Width: | Height: | Size: 819 B |
BIN
app/src/main/res/drawable-xxxhdpi/ic_money_off_white_24dp.png
Normal file
After Width: | Height: | Size: 742 B |
BIN
app/src/main/res/drawable-xxxhdpi/ic_security_white_24dp.png
Normal file
After Width: | Height: | Size: 913 B |
11
app/src/main/res/drawable/metered.xml
Normal file
|
@ -0,0 +1,11 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<level-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item
|
||||
android:drawable="@drawable/ic_money_off_white_24dp"
|
||||
android:maxLevel="0"
|
||||
android:minLevel="0" />
|
||||
<item
|
||||
android:drawable="@drawable/ic_attach_money_white_24dp"
|
||||
android:maxLevel="1"
|
||||
android:minLevel="1" />
|
||||
</level-list>
|
|
@ -11,21 +11,36 @@
|
|||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginStart="12dp" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/ivInteractive"
|
||||
android:layout_width="20dp"
|
||||
android:layout_height="20dp"
|
||||
<LinearLayout
|
||||
android:id="@+id/llIndicators"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginStart="12dp"
|
||||
android:src="@drawable/ic_perm_identity_white_24dp"
|
||||
android:visibility="invisible" />
|
||||
android:orientation="horizontal"
|
||||
android:visibility="gone">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/ivNetwork"
|
||||
android:layout_width="20dp"
|
||||
android:layout_height="20dp"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginStart="4dp"
|
||||
android:src="@drawable/network"
|
||||
android:visibility="gone" />
|
||||
<ImageView
|
||||
android:id="@+id/ivInteractive"
|
||||
android:layout_width="16dp"
|
||||
android:layout_height="16dp"
|
||||
android:layout_marginStart="12dp"
|
||||
android:src="@drawable/ic_perm_identity_white_24dp"
|
||||
android:visibility="invisible" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/ivNetwork"
|
||||
android:layout_width="16dp"
|
||||
android:layout_height="16dp"
|
||||
android:layout_marginStart="4dp"
|
||||
android:src="@drawable/network"
|
||||
android:visibility="gone" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/ivMetered"
|
||||
android:layout_width="16dp"
|
||||
android:layout_height="16dp"
|
||||
android:layout_marginStart="4dp"
|
||||
android:src="@drawable/metered"
|
||||
android:visibility="gone" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
|
@ -8,34 +8,8 @@
|
|||
netguard:actionViewClass="android.support.v7.widget.SearchView"
|
||||
netguard:showAsAction="always|collapseActionView" />
|
||||
<item
|
||||
android:id="@+id/menu_whitelist_wifi"
|
||||
android:checkable="true"
|
||||
android:title="@string/menu_whitelist_wifi" />
|
||||
<item
|
||||
android:id="@+id/menu_whitelist_other"
|
||||
android:checkable="true"
|
||||
android:title="@string/menu_whitelist_other" />
|
||||
<item
|
||||
android:id="@+id/menu_whitelist_roaming"
|
||||
android:checkable="true"
|
||||
android:title="@string/menu_whitelist_roaming" />
|
||||
<item
|
||||
android:id="@+id/menu_system"
|
||||
android:checkable="true"
|
||||
android:title="@string/menu_system" />
|
||||
<item
|
||||
android:id="@+id/menu_export"
|
||||
android:title="@string/menu_export" />
|
||||
<item
|
||||
android:id="@+id/menu_import"
|
||||
android:title="@string/menu_import" />
|
||||
<item
|
||||
android:id="@+id/menu_theme"
|
||||
android:checkable="true"
|
||||
android:title="@string/menu_dark" />
|
||||
<item
|
||||
android:id="@+id/menu_vpn_settings"
|
||||
android:title="@string/menu_vpn_settings" />
|
||||
android:id="@+id/menu_settings"
|
||||
android:title="@string/menu_settings" />
|
||||
<item
|
||||
android:id="@+id/menu_support"
|
||||
android:title="@string/menu_support" />
|
||||
|
|
|
@ -8,17 +8,23 @@ This is caused by bugs in Android, or in the software provided by the manufactur
|
|||
\n\nBy using NetGuard, you agree to the <a href="http://www.gnu.org/licenses/gpl.txt">GNU General Public License version 3</a></string>
|
||||
|
||||
<string name="menu_search">البحث عن تطبيقات</string>
|
||||
<string name="menu_whitelist_wifi">حظر الواي فاي بشكل افتراضي</string>
|
||||
<string name="menu_whitelist_other">حظر الشبكة بشكل افتراضي</string>
|
||||
<string name="menu_whitelist_roaming">Block roaming by default</string>
|
||||
<string name="menu_system">Manage system applications</string>
|
||||
<string name="menu_export">Export settings</string>
|
||||
<string name="menu_import">Import settings</string>
|
||||
<string name="menu_dark">استخدام الثيم الداكن</string>
|
||||
<string name="menu_vpn_settings">فتح إعدادات الـVPN</string>
|
||||
<string name="menu_settings">Settings</string>
|
||||
<string name="menu_support">الدعم</string>
|
||||
<string name="menu_about">حول</string>
|
||||
|
||||
<string name="setting_whitelist_wifi">حظر الواي فاي بشكل افتراضي</string>
|
||||
<string name="setting_whitelist_other">حظر الشبكة بشكل افتراضي</string>
|
||||
<string name="setting_whitelist_roaming">Block roaming by default</string>
|
||||
<string name="setting_system">Manage system applications</string>
|
||||
<string name="setting_dark">استخدام الثيم الداكن</string>
|
||||
<string name="setting_indicators">Show state indicators</string>
|
||||
<string name="setting_export">Export settings</string>
|
||||
<string name="setting_import">Import settings</string>
|
||||
<string name="setting_vpn">فتح إعدادات الـVPN</string>
|
||||
|
||||
<string name="summary_system">Define rules for system applications, for experts only</string>
|
||||
<string name="summary_indicators">Display the network type and if the network is metered in the action bar</string>
|
||||
|
||||
<string name="msg_sure">هل أنت متأكد؟</string>
|
||||
<string name="msg_disabled">التطبيق غير مُفعّل, قم بتفعيل التطبيق من الخيار أعلاه.</string>
|
||||
<string name="msg_revoked">NetGuard has been disabled</string>
|
||||
|
|
|
@ -4,20 +4,26 @@
|
|||
<string name="app_first">Netguard wurde mit großer Sorgfalt entwickelt, jedoch ist es unmöglich zu garantieren, dass es auf jedem Gerät korrekt arbeitet.
|
||||
Es ist bekannt, dass Netguard zu Abstürzen führen kann und, dass auf manchen Geräten sämtlicher Netzwerkverkehr blockiert wird.
|
||||
Das wird von Fehlern in Android oder in Software vom Hersteller verursacht. Bitte beschuldigen sie bei solchen Fehlern nicht Netguard.
|
||||
+\n\nMit der Verwendung von NetGuard, akzeptierst du die <a href="http://www.gnu.org/licenses/gpl.txt">GNU General Public License version 3</a></string>
|
||||
\n\nMit der Verwendung von NetGuard, akzeptierst du die <a href="http://www.gnu.org/licenses/gpl.txt">GNU General Public License version 3</a></string>
|
||||
|
||||
<string name="menu_search">Suche nach Apps</string>
|
||||
<string name="menu_whitelist_wifi">Blockiere Wi-Fi standardmäßig</string>
|
||||
<string name="menu_whitelist_other">Blockiere Mobilfunk standardmäßig</string>
|
||||
<string name="menu_whitelist_roaming">Blockiere Roaming standardmäßig</string>
|
||||
<string name="menu_system">Zeige System Apps</string>
|
||||
<string name="menu_export">Exportiere Einstellungen</string>
|
||||
<string name="menu_import">Importiere Einstellungen</string>
|
||||
<string name="menu_dark">Verwende dunkles Theme</string>
|
||||
<string name="menu_vpn_settings">Öffne Android VPN Einstellungen</string>
|
||||
<string name="menu_settings">Einstellungen</string>
|
||||
<string name="menu_support">Hilfe</string>
|
||||
<string name="menu_about">Über</string>
|
||||
|
||||
<string name="setting_whitelist_wifi">Blockiere Wi-Fi standardmäßig</string>
|
||||
<string name="setting_whitelist_other">Blockiere Mobilfunk standardmäßig</string>
|
||||
<string name="setting_whitelist_roaming">Blockiere Roaming standardmäßig</string>
|
||||
<string name="setting_system">Zeige System Apps</string>
|
||||
<string name="setting_dark">Verwende dunkles Theme</string>
|
||||
<string name="setting_indicators">Show state indicators</string>
|
||||
<string name="setting_export">Exportiere Einstellungen</string>
|
||||
<string name="setting_import">Importiere Einstellungen</string>
|
||||
<string name="setting_vpn">Öffne Android VPN Einstellungen</string>
|
||||
|
||||
<string name="summary_system">Define rules for system applications, for experts only</string>
|
||||
<string name="summary_indicators">Display the network type and if the network is metered in the action bar</string>
|
||||
|
||||
<string name="msg_sure">Bist du sicher?</string>
|
||||
<string name="msg_disabled">NetGuard ist deaktiviert, verwende den Schalter um NetGuard zu aktivieren</string>
|
||||
<string name="msg_revoked">NetGuard wurde deaktiviert</string>
|
||||
|
|
|
@ -8,17 +8,23 @@ Esto es causado por errores en Android, o por el software proporcionado por el f
|
|||
\n\nAl utilizar NetGuard, estás aceptando la <a href="http://www.gnu.org/licenses/gpl.txt">Licencia Pública GNU General Public versión 3</a></string>
|
||||
|
||||
<string name="menu_search">Buscar aplicación</string>
|
||||
<string name="menu_whitelist_wifi">Bloquear Wi-Fi por defecto</string>
|
||||
<string name="menu_whitelist_other">Bloquear red móvil por defecto</string>
|
||||
<string name="menu_whitelist_roaming">Bloquear roaming por defecto</string>
|
||||
<string name="menu_system">Administrar aplicaciones de sistema</string>
|
||||
<string name="menu_export">Exportar configuración</string>
|
||||
<string name="menu_import">Importar configuración</string>
|
||||
<string name="menu_dark">Usar tema oscuro</string>
|
||||
<string name="menu_vpn_settings">Abrir configuración VPN de Android</string>
|
||||
<string name="menu_settings">Configuración</string>
|
||||
<string name="menu_support">Soporte</string>
|
||||
<string name="menu_about">Acerca de</string>
|
||||
|
||||
<string name="setting_whitelist_wifi">Bloquear Wi-Fi por defecto</string>
|
||||
<string name="setting_whitelist_other">Bloquear red móvil por defecto</string>
|
||||
<string name="setting_whitelist_roaming">Bloquear roaming por defecto</string>
|
||||
<string name="setting_system">Administrar aplicaciones de sistema</string>
|
||||
<string name="setting_dark">Usar tema oscuro</string>
|
||||
<string name="setting_indicators">Show state indicators</string>
|
||||
<string name="setting_export">Exportar configuración</string>
|
||||
<string name="setting_import">Importar configuración</string>
|
||||
<string name="setting_vpn">Abrir configuración VPN de Android</string>
|
||||
|
||||
<string name="summary_system">Define rules for system applications, for experts only</string>
|
||||
<string name="summary_indicators">Display the network type and if the network is metered in the action bar</string>
|
||||
|
||||
<string name="msg_sure">¿Estás seguro?</string>
|
||||
<string name="msg_disabled">NetGuard está deshabilitado, utiliza el interruptor de arriba para habilitar a NetGuard</string>
|
||||
<string name="msg_revoked">NetGuard ha sido deshabilitado</string>
|
||||
|
|
|
@ -8,17 +8,23 @@ Ceci est causé par des bugs dans Android, ou dans le logiciel fourni par le con
|
|||
\n\nEn utilisant NetGuard, vous acceptez la <a href="http://www.gnu.org/licenses/gpl.txt">GNU General Public License version 3</a></string>
|
||||
|
||||
<string name="menu_search">Recherche application</string>
|
||||
<string name="menu_whitelist_wifi">Blocage Wi-Fi par défaut</string>
|
||||
<string name="menu_whitelist_other">Blocage données mobiles par défaut</string>
|
||||
<string name="menu_whitelist_roaming">Blocage roaming par défaut</string>
|
||||
<string name="menu_system">Gérer les applications système</string>
|
||||
<string name="menu_export">Exporter paramètres</string>
|
||||
<string name="menu_import">Importer paramètres</string>
|
||||
<string name="menu_dark">Utiliser le thème sombre</string>
|
||||
<string name="menu_vpn_settings">Ouvrir les paramètres VPN</string>
|
||||
<string name="menu_settings">Paramètres</string>
|
||||
<string name="menu_support">Support</string>
|
||||
<string name="menu_about">À propos</string>
|
||||
|
||||
<string name="setting_whitelist_wifi">Blocage Wi-Fi par défaut</string>
|
||||
<string name="setting_whitelist_other">Blocage données mobiles par défaut</string>
|
||||
<string name="setting_whitelist_roaming">Blocage roaming par défaut</string>
|
||||
<string name="setting_system">Gérer les applications système</string>
|
||||
<string name="setting_dark">Utiliser le thème sombre</string>
|
||||
<string name="setting_indicators">Show state indicators</string>
|
||||
<string name="setting_export">Exporter paramètres</string>
|
||||
<string name="setting_import">Importer paramètres</string>
|
||||
<string name="setting_vpn">Ouvrir les paramètres VPN</string>
|
||||
|
||||
<string name="summary_system">Define rules for system applications, for experts only</string>
|
||||
<string name="summary_indicators">Display the network type and if the network is metered in the action bar</string>
|
||||
|
||||
<string name="msg_sure">Etes-vous sûr ?</string>
|
||||
<string name="msg_disabled">NetGuard est désactivé, utilisez le bouton ci-dessus pour activer NetGuard</string>
|
||||
<string name="msg_revoked">NetGuard a été désactivé</string>
|
||||
|
|
|
@ -9,17 +9,23 @@ Ció è causato da alcuni bug contenuti in Android, o in programmi forniti dal p
|
|||
</string>
|
||||
|
||||
<string name="menu_search">Cerca applicazione</string>
|
||||
<string name="menu_whitelist_wifi">Blocca Wi-Fi di default</string>
|
||||
<string name="menu_whitelist_other">Blocca rete dati di default</string>
|
||||
<string name="menu_whitelist_roaming">Blocca roaming di default</string>
|
||||
<string name="menu_system">Gestisci applicazioni di sistema</string>
|
||||
<string name="menu_export">Esporta impostazioni</string>
|
||||
<string name="menu_import">Importa impostazioni</string>
|
||||
<string name="menu_dark">Usa il tema scuro</string>
|
||||
<string name="menu_vpn_settings">Apri impostazioni VPN</string>
|
||||
<string name="menu_settings">Impostazioni</string>
|
||||
<string name="menu_support">Supporto</string>
|
||||
<string name="menu_about">Info</string>
|
||||
|
||||
<string name="setting_whitelist_wifi">Blocca Wi-Fi di default</string>
|
||||
<string name="setting_whitelist_other">Blocca rete dati di default</string>
|
||||
<string name="setting_whitelist_roaming">Blocca roaming di default</string>
|
||||
<string name="setting_system">Gestisci applicazioni di sistema</string>
|
||||
<string name="setting_dark">Usa il tema scuro</string>
|
||||
<string name="setting_indicators">Mostra indicatori di stato</string>
|
||||
<string name="setting_export">Esporta impostazioni</string>
|
||||
<string name="setting_import">Importa impostazioni</string>
|
||||
<string name="setting_vpn">Apri impostazioni VPN</string>
|
||||
|
||||
<string name="summary_system">Define rules for system applications, for experts only</string>
|
||||
<string name="summary_indicators">Display the network type and if the network is metered in the action bar</string>
|
||||
|
||||
<string name="msg_sure">Sei sicuro?</string>
|
||||
<string name="msg_disabled">NetGuard è disabilitata, usa lo switch per abilitarla nuovamente</string>
|
||||
<string name="msg_revoked">NetGuard è stata disabilitata</string>
|
||||
|
|
|
@ -8,17 +8,23 @@ This is caused by bugs in Android, or in the software provided by the manufactur
|
|||
\n\nBy using NetGuard, you agree to the <a href="http://www.gnu.org/licenses/gpl.txt">GNU General Public License version 3</a></string>
|
||||
|
||||
<string name="menu_search">앱 검색</string>
|
||||
<string name="menu_whitelist_wifi">Wi-Fi 차단을 기본 설정으로</string>
|
||||
<string name="menu_whitelist_other">모바일 데이터 차단을 기본 설정으로</string>
|
||||
<string name="menu_whitelist_roaming">Block roaming by default</string>
|
||||
<string name="menu_system">Manage system applications</string>
|
||||
<string name="menu_export">Export settings</string>
|
||||
<string name="menu_import">Import settings</string>
|
||||
<string name="menu_dark">어두운 테마 사용</string>
|
||||
<string name="menu_vpn_settings">Android VPN 설정 열기</string>
|
||||
<string name="menu_settings">Settings</string>
|
||||
<string name="menu_support">지원</string>
|
||||
<string name="menu_about">넷가드 정보</string>
|
||||
|
||||
<string name="setting_whitelist_wifi">Wi-Fi 차단을 기본 설정으로</string>
|
||||
<string name="setting_whitelist_other">모바일 데이터 차단을 기본 설정으로</string>
|
||||
<string name="setting_whitelist_roaming">Block roaming by default</string>
|
||||
<string name="setting_system">Manage system applications</string>
|
||||
<string name="setting_dark">어두운 테마 사용</string>
|
||||
<string name="setting_indicators">Show state indicators</string>
|
||||
<string name="setting_export">Export settings</string>
|
||||
<string name="setting_import">Import settings</string>
|
||||
<string name="setting_vpn">Android VPN 설정 열기</string>
|
||||
|
||||
<string name="summary_system">Define rules for system applications, for experts only</string>
|
||||
<string name="summary_indicators">Display the network type and if the network is metered in the action bar</string>
|
||||
|
||||
<string name="msg_sure">계속 하시겠습니까?</string>
|
||||
<string name="msg_disabled">넷가드가 해제되어 있습니다. 상단 스위치를 사용해 넷가드를 활성화하세요.</string>
|
||||
<string name="msg_revoked">넷가드가 해제되었습니다</string>
|
||||
|
|
|
@ -8,17 +8,23 @@ This is caused by bugs in Android, or in the software provided by the manufactur
|
|||
\n\nBy using NetGuard, you agree to the <a href="http://www.gnu.org/licenses/gpl.txt">GNU General Public License version 3</a></string>
|
||||
|
||||
<string name="menu_search">Zoek naar applicatie</string>
|
||||
<string name="menu_whitelist_wifi">Blokkeer Wi-Fi standaard</string>
|
||||
<string name="menu_whitelist_other">Blokkeer mobiel standaard</string>
|
||||
<string name="menu_whitelist_roaming">Blokkeer roaming standaard</string>
|
||||
<string name="menu_system">Beheer systeemapplicaties</string>
|
||||
<string name="menu_export">Exporteer instellingen</string>
|
||||
<string name="menu_import">Importeer instellingen</string>
|
||||
<string name="menu_dark">Gebruik donker thema</string>
|
||||
<string name="menu_vpn_settings">Open Android VPN-instellingen</string>
|
||||
<string name="menu_settings">Instellingen</string>
|
||||
<string name="menu_support">Ondersteuning</string>
|
||||
<string name="menu_about">Over</string>
|
||||
|
||||
<string name="setting_whitelist_wifi">Blokkeer Wi-Fi standaard</string>
|
||||
<string name="setting_whitelist_other">Blokkeer mobiel standaard</string>
|
||||
<string name="setting_whitelist_roaming">Blokkeer roaming standaard</string>
|
||||
<string name="setting_system">Beheer systeemapplicaties</string>
|
||||
<string name="setting_dark">Gebruik donker thema</string>
|
||||
<string name="setting_indicators">Toon staat indicatoren</string>
|
||||
<string name="setting_export">Exporteer instellingen</string>
|
||||
<string name="setting_import">Importeer instellingen</string>
|
||||
<string name="setting_vpn">Open Android VPN-instellingen</string>
|
||||
|
||||
<string name="summary_system">Define rules for system applications, for experts only</string>
|
||||
<string name="summary_indicators">Display the network type and if the network is metered in the action bar</string>
|
||||
|
||||
<string name="msg_sure">Weet u het zeker?</string>
|
||||
<string name="msg_disabled">NetGuard staat uit, gebruik de schakelaar boven om NetGuard aan te zetten</string>
|
||||
<string name="msg_revoked">NetGuard is uitgezet</string>
|
||||
|
|
|
@ -8,22 +8,28 @@ Acest lucru este cauzat de bug-uri in Android sau in software-ul pus la dispozit
|
|||
\n\nFolosind NetGuard, sunteti de acord cu <a href="http://www.gnu.org/licenses/gpl.txt">GNU General Public License version 3</a></string>
|
||||
|
||||
<string name="menu_search">Cauta aplicatii</string>
|
||||
<string name="menu_whitelist_wifi">Blocheaza implicit Wi-Fi</string>
|
||||
<string name="menu_whitelist_other">Blocheaza implicit date mobile</string>
|
||||
<string name="menu_whitelist_roaming">Blocheaza implicit in roaming</string>
|
||||
<string name="menu_system">Gestionati aplicatiile de sistem</string>
|
||||
<string name="menu_export">Exporta setari</string>
|
||||
<string name="menu_import">Importa setari</string>
|
||||
<string name="menu_dark">Foloseste tema intunecata</string>
|
||||
<string name="menu_vpn_settings">Deschide setari VPN Android</string>
|
||||
<string name="menu_settings">Setari</string>
|
||||
<string name="menu_support">Asistenta</string>
|
||||
<string name="menu_about">Despre</string>
|
||||
|
||||
<string name="setting_whitelist_wifi">Blocheaza implicit Wi-Fi</string>
|
||||
<string name="setting_whitelist_other">Blocheaza implicit date mobile</string>
|
||||
<string name="setting_whitelist_roaming">Blocheaza implicit in roaming</string>
|
||||
<string name="setting_system">Gestionati aplicatiile de sistem</string>
|
||||
<string name="setting_dark">Foloseste tema intunecata</string>
|
||||
<string name="setting_indicators">Arata indicatorii de stare</string>
|
||||
<string name="setting_export">Exporta setari</string>
|
||||
<string name="setting_import">Importa setari</string>
|
||||
<string name="setting_vpn">Deschide setari VPN Android</string>
|
||||
|
||||
<string name="summary_system">Defineste reguli pentru aplicatiile de sistem, setare expert</string>
|
||||
<string name="summary_indicators">Arata tipul retelei conectate precum si daca aceasta este una contorizata</string>
|
||||
|
||||
<string name="msg_sure">Esti sigur?</string>
|
||||
<string name="msg_disabled">NetGuard este momentan dezactivat, foloseste comutatorul de mai sus pentru a il activa</string>
|
||||
<string name="msg_revoked">NetGuard a fost dezactivat</string>
|
||||
<string name="msg_completed">Setari aplicate</string>
|
||||
<string name="msg_vpn">NetGuard foloseste o conexiune locala VPN ca o "gaura neagra" pentru traficul de internet blocat,
|
||||
<string name="msg_vpn">NetGuard foloseste o conexiune locala VPN ca o \"gaura neagra\" pentru traficul de internet blocat,
|
||||
din acest motiv la urmatoarea fereastra de dialog trebuie sa acceptati crearea conexiunii VPN.</string>
|
||||
|
||||
<string name="title_using">Permite cand dispozitivul este folosit</string>
|
||||
|
|
|
@ -8,17 +8,23 @@ Je to spôsobené chybami v Androide alebo v softvéri poskytovanom výrobcom, p
|
|||
\n\nPoužívaním aplikácie NetGuard súhlasíte so <a href="http://www.gnu.org/licenses/gpl.txt">Všeobecnou verejnou licenciou GNU, verzia 3</a></string>
|
||||
|
||||
<string name="menu_search">Hľadať aplikáciu</string>
|
||||
<string name="menu_whitelist_wifi">Predvolene blokovať Wi-Fi</string>
|
||||
<string name="menu_whitelist_other">Predvolene blokovať mobilné dáta</string>
|
||||
<string name="menu_whitelist_roaming">Predvolene blokovať roaming</string>
|
||||
<string name="menu_system">Spravovať systémové aplikácie</string>
|
||||
<string name="menu_export">Exportovať nastavenia</string>
|
||||
<string name="menu_import">Importovať nastavenia</string>
|
||||
<string name="menu_dark">Použiť tmavú tému</string>
|
||||
<string name="menu_vpn_settings">Otvoriť nastavenia VPN</string>
|
||||
<string name="menu_settings">Nastavenia</string>
|
||||
<string name="menu_support">Podpora</string>
|
||||
<string name="menu_about">O aplikácii</string>
|
||||
|
||||
<string name="setting_whitelist_wifi">Predvolene blokovať Wi-Fi</string>
|
||||
<string name="setting_whitelist_other">Predvolene blokovať mobilné dáta</string>
|
||||
<string name="setting_whitelist_roaming">Predvolene blokovať roaming</string>
|
||||
<string name="setting_system">Spravovať systémové aplikácie</string>
|
||||
<string name="setting_dark">Použiť tmavú tému</string>
|
||||
<string name="setting_indicators">Show state indicators</string>
|
||||
<string name="setting_export">Exportovať nastavenia</string>
|
||||
<string name="setting_import">Importovať nastavenia</string>
|
||||
<string name="setting_vpn">Otvoriť nastavenia VPN</string>
|
||||
|
||||
<string name="summary_system">Define rules for system applications, for experts only</string>
|
||||
<string name="summary_indicators">Display the network type and if the network is metered in the action bar</string>
|
||||
|
||||
<string name="msg_sure">Ste si istý?</string>
|
||||
<string name="msg_disabled">NetGuard je vypnutý, použite prepínač vyššie na zapnutie NetGuard</string>
|
||||
<string name="msg_revoked">NetGuard je vypnutý</string>
|
||||
|
|
|
@ -8,17 +8,23 @@
|
|||
\n\n使用NetGuard即表明您接受 <a href="http://www.gnu.org/licenses/gpl.txt">GNU通用公共许可协议第三版</a></string>
|
||||
|
||||
<string name="menu_search">搜索应用</string>
|
||||
<string name="menu_whitelist_wifi">默认阻止Wi-Fi网络</string>
|
||||
<string name="menu_whitelist_other">默认阻止移动网络</string>
|
||||
<string name="menu_whitelist_roaming">默认阻止漫游</string>
|
||||
<string name="menu_system">管理系统应用</string>
|
||||
<string name="menu_export">导出设置</string>
|
||||
<string name="menu_import">导入设置</string>
|
||||
<string name="menu_dark">使用暗色主题</string>
|
||||
<string name="menu_vpn_settings">打开安卓VPN设置</string>
|
||||
<string name="menu_settings">Settings</string>
|
||||
<string name="menu_support">软件支持</string>
|
||||
<string name="menu_about">关于</string>
|
||||
|
||||
<string name="setting_whitelist_wifi">默认阻止Wi-Fi网络</string>
|
||||
<string name="setting_whitelist_other">默认阻止移动网络</string>
|
||||
<string name="setting_whitelist_roaming">默认阻止漫游</string>
|
||||
<string name="setting_system">管理系统应用</string>
|
||||
<string name="setting_dark">使用暗色主题</string>
|
||||
<string name="setting_indicators">显示状态指示器</string>
|
||||
<string name="setting_export">导出设置</string>
|
||||
<string name="setting_import">导入设置</string>
|
||||
<string name="setting_vpn">打开安卓VPN设置</string>
|
||||
|
||||
<string name="summary_system">定义系统应用规则, 仅供专业用户</string>
|
||||
<string name="summary_indicators">在状态栏显示网络类型及网络是否按流量计费</string>
|
||||
|
||||
<string name="msg_sure">是否确认?</string>
|
||||
<string name="msg_disabled">NetGuard已被停用, 请使用上方的开关启用NetGuard</string>
|
||||
<string name="msg_revoked">NetGuard已被停用</string>
|
||||
|
|
|
@ -9,17 +9,23 @@ This is caused by bugs in Android, or in the software provided by the manufactur
|
|||
\n\nBy using NetGuard, you agree to the <a href="http://www.gnu.org/licenses/gpl.txt">GNU General Public License version 3</a></string>
|
||||
|
||||
<string name="menu_search">Search for application</string>
|
||||
<string name="menu_whitelist_wifi">Block Wi-Fi by default</string>
|
||||
<string name="menu_whitelist_other">Block mobile by default</string>
|
||||
<string name="menu_whitelist_roaming">Block roaming by default</string>
|
||||
<string name="menu_system">Manage system applications</string>
|
||||
<string name="menu_export">Export settings</string>
|
||||
<string name="menu_import">Import settings</string>
|
||||
<string name="menu_dark">Use dark theme</string>
|
||||
<string name="menu_vpn_settings">Open Android VPN settings</string>
|
||||
<string name="menu_settings">Settings</string>
|
||||
<string name="menu_support">Support</string>
|
||||
<string name="menu_about">About</string>
|
||||
|
||||
<string name="setting_whitelist_wifi">Block Wi-Fi by default</string>
|
||||
<string name="setting_whitelist_other">Block mobile by default</string>
|
||||
<string name="setting_whitelist_roaming">Block roaming by default</string>
|
||||
<string name="setting_system">Manage system applications</string>
|
||||
<string name="setting_dark">Use dark theme</string>
|
||||
<string name="setting_indicators">Show state indicators</string>
|
||||
<string name="setting_export">Export settings</string>
|
||||
<string name="setting_import">Import settings</string>
|
||||
<string name="setting_vpn">Open Android VPN settings</string>
|
||||
|
||||
<string name="summary_system">Define rules for system applications, for experts only</string>
|
||||
<string name="summary_indicators">Display the network type and if the network is metered in the action bar</string>
|
||||
|
||||
<string name="msg_sure">Are you sure?</string>
|
||||
<string name="msg_disabled">NetGuard is disabled, use the switch above to enable NetGuard</string>
|
||||
<string name="msg_revoked">NetGuard has been disabled</string>
|
||||
|
@ -27,7 +33,7 @@ This is caused by bugs in Android, or in the software provided by the manufactur
|
|||
<string name="msg_vpn">NetGuard uses a local VPN as a sinkhole for blocked internet traffic,
|
||||
for this reason you should allow a VPN connection in the next dialog</string>
|
||||
|
||||
<string name="title_using">Allow when device in use</string>
|
||||
<string name="title_using">Allow when device is in use</string>
|
||||
<string name="title_roaming">Block when roaming</string>
|
||||
<string name="title_launch">Start application</string>
|
||||
<string name="title_donate">Donate</string>
|
||||
|
|
38
app/src/main/res/xml/preferences.xml
Normal file
|
@ -0,0 +1,38 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<CheckBoxPreference
|
||||
android:defaultValue="true"
|
||||
android:key="whitelist_wifi"
|
||||
android:title="@string/setting_whitelist_wifi" />
|
||||
<CheckBoxPreference
|
||||
android:defaultValue="true"
|
||||
android:key="whitelist_other"
|
||||
android:title="@string/setting_whitelist_other" />
|
||||
<CheckBoxPreference
|
||||
android:defaultValue="true"
|
||||
android:key="whitelist_roaming"
|
||||
android:title="@string/setting_whitelist_roaming" />
|
||||
<CheckBoxPreference
|
||||
android:defaultValue="false"
|
||||
android:key="manage_system"
|
||||
android:summary="@string/summary_system"
|
||||
android:title="@string/setting_system" />
|
||||
<CheckBoxPreference
|
||||
android:defaultValue="false"
|
||||
android:key="dark_theme"
|
||||
android:title="@string/setting_dark" />
|
||||
<CheckBoxPreference
|
||||
android:defaultValue="false"
|
||||
android:key="indicators"
|
||||
android:summary="@string/summary_indicators"
|
||||
android:title="@string/setting_indicators" />
|
||||
<Preference
|
||||
android:key="export"
|
||||
android:title="@string/setting_export" />
|
||||
<Preference
|
||||
android:key="import"
|
||||
android:title="@string/setting_import" />
|
||||
<Preference
|
||||
android:key="vpn"
|
||||
android:title="@string/setting_vpn" />
|
||||
</PreferenceScreen>
|