1
0
Fork 0
mirror of https://github.com/M66B/NetGuard.git synced 2025-02-26 16:13:01 +00:00

Added filtering warning dialog

@licaon-kter maybe you have better suggestion for the new texts related to filtering
This commit is contained in:
M66B 2016-01-19 18:29:58 +01:00
parent 05c01f08e0
commit ca103c7313
4 changed files with 71 additions and 1 deletions

View file

@ -678,7 +678,6 @@ public class ActivityMain extends AppCompatActivity implements SharedPreferences
dialogAbout.show();
}
private static Intent getIntentInvite(Context context) {
Intent intent = new Intent("com.google.android.gms.appinvite.ACTION_APP_INVITE");
intent.setPackage("com.google.android.gms");

View file

@ -21,8 +21,10 @@ package eu.faircode.netguard;
import android.Manifest;
import android.annotation.TargetApi;
import android.app.AlertDialog;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.SharedPreferences;
@ -49,6 +51,8 @@ import android.telephony.TelephonyManager;
import android.text.TextUtils;
import android.util.Log;
import android.util.Xml;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.Toast;
import org.xml.sax.Attributes;
@ -345,6 +349,22 @@ public class ActivitySettings extends AppCompatActivity implements SharedPrefere
// TODO pro feature
SinkholeService.reload(null, "setting changed", this);
// Show dialog
if (prefs.getBoolean(name, false)) {
LayoutInflater inflater = LayoutInflater.from(ActivitySettings.this);
View view = inflater.inflate(R.layout.filter, null);
new AlertDialog.Builder(ActivitySettings.this)
.setView(view)
.setCancelable(false)
.setPositiveButton(android.R.string.yes, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
// Do nothing
}
})
.create().show();
}
} else if ("auto_enable".equals(name))
getPreferenceScreen().findPreference(name).setTitle(getString(R.string.setting_auto, prefs.getString(name, "0")));

View file

@ -0,0 +1,50 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:paddingBottom="16dp"
android:paddingEnd="16dp"
android:paddingStart="16dp"
android:paddingTop="16dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:src="@mipmap/ic_launcher" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginStart="8dp"
android:text="@string/app_name"
android:textAppearance="@android:style/TextAppearance.Material.Large"
android:textStyle="bold" />
</LinearLayout>
<ScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/msg_filter"
android:textAppearance="@android:style/TextAppearance.Material.Medium" />
</LinearLayout>
</ScrollView>
</LinearLayout>

View file

@ -98,6 +98,7 @@ Since NetGuard has no internet permission, you know your internet traffic is not
<string name="msg_mbday">&#177; %1$.3f&#9650; %2$.3f&#9660; MB/day</string>
<string name="msg_kbsec">%7.3f KB/s</string>
<string name="msg_mbsec">%7.3f MB/s</string>
<string name="msg_filter">Filtering will let Android account data usage and related battery usage of applications to NetGuard</string>
<string name="title_screen_wifi">Allow Wi-Fi when screen is on</string>
<string name="title_screen_other">Allow mobile when screen is on</string>