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:
parent
05c01f08e0
commit
ca103c7313
4 changed files with 71 additions and 1 deletions
|
@ -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");
|
||||
|
|
|
@ -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")));
|
||||
|
||||
|
|
50
app/src/main/res/layout/filter.xml
Normal file
50
app/src/main/res/layout/filter.xml
Normal 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>
|
|
@ -98,6 +98,7 @@ Since NetGuard has no internet permission, you know your internet traffic is not
|
|||
<string name="msg_mbday">± %1$.3f▲ %2$.3f▼ 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>
|
||||
|
|
Loading…
Reference in a new issue