Added hint to enable black list mode

This commit is contained in:
M66B 2016-06-27 10:18:39 +02:00
parent 55f8b2f46f
commit 0583ee4bc9
4 changed files with 69 additions and 19 deletions

View File

@ -42,12 +42,6 @@
<sourceFolder url="file://$MODULE_DIR$/src/allDebug/jni" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/allDebug/renderscript" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/allDebug/shaders" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/r/androidTest/all/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/aidl/androidTest/all/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/androidTest/all/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/rs/androidTest/all/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/androidTest/all/debug" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/resValues/androidTest/all/debug" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/testAllDebug/res" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/testAllDebug/resources" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/testAllDebug/assets" type="java-test-resource" />
@ -56,6 +50,12 @@
<sourceFolder url="file://$MODULE_DIR$/src/testAllDebug/jni" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/testAllDebug/rs" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/testAllDebug/shaders" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/r/androidTest/all/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/aidl/androidTest/all/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/androidTest/all/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/rs/androidTest/all/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/androidTest/all/debug" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/resValues/androidTest/all/debug" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/all/res" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/all/resources" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/all/assets" type="java-resource" />
@ -64,14 +64,6 @@
<sourceFolder url="file://$MODULE_DIR$/src/all/jni" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/all/renderscript" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/all/shaders" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTestAll/res" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTestAll/resources" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTestAll/assets" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTestAll/aidl" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTestAll/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTestAll/jni" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTestAll/rs" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTestAll/shaders" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/testAll/res" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/testAll/resources" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/testAll/assets" type="java-test-resource" />
@ -80,6 +72,14 @@
<sourceFolder url="file://$MODULE_DIR$/src/testAll/jni" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/testAll/rs" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/testAll/shaders" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTestAll/res" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTestAll/resources" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTestAll/assets" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTestAll/aidl" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTestAll/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTestAll/jni" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTestAll/rs" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTestAll/shaders" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/res" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/resources" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/assets" type="java-resource" />

View File

@ -273,12 +273,27 @@ public class ActivityMain extends AppCompatActivity implements SharedPreferences
}
});
// Hint white listing
final LinearLayout llWhitelist = (LinearLayout) findViewById(R.id.llWhitelist);
Button btnWhitelist = (Button) findViewById(R.id.btnWhitelist);
boolean whitelist_wifi = prefs.getBoolean("whitelist_wifi", false);
boolean whitelist_other = prefs.getBoolean("whitelist_other", false);
boolean hintWhitelist = prefs.getBoolean("hint_whitelist", true);
llWhitelist.setVisibility(!(whitelist_wifi || whitelist_other) && hintWhitelist ? View.VISIBLE : View.GONE);
btnWhitelist.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
prefs.edit().putBoolean("hint_whitelist", false).apply();
llWhitelist.setVisibility(View.GONE);
}
});
// Hint system applications
final LinearLayout llSystem = (LinearLayout) findViewById(R.id.llSystem);
Button btnSystem = (Button) findViewById(R.id.btnSystem);
boolean system = prefs.getBoolean("manage_system", false);
boolean hint = prefs.getBoolean("hint_system", true);
llSystem.setVisibility(!system && hint ? View.VISIBLE : View.GONE);
boolean hintSystem = prefs.getBoolean("hint_system", true);
llSystem.setVisibility(!system && hintSystem ? View.VISIBLE : View.GONE);
btnSystem.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
@ -531,12 +546,19 @@ public class ActivityMain extends AppCompatActivity implements SharedPreferences
"show_nointernet".equals(name) ||
"show_disabled".equals(name) ||
"sort".equals(name) ||
"imported".equals(name))
"imported".equals(name)) {
updateApplicationList(null);
else if ("manage_system".equals(name)) {
final LinearLayout llWhitelist = (LinearLayout) findViewById(R.id.llWhitelist);
boolean whitelist_wifi = prefs.getBoolean("whitelist_wifi", false);
boolean whitelist_other = prefs.getBoolean("whitelist_other", false);
boolean hintWhitelist = prefs.getBoolean("hint_whitelist", true);
llWhitelist.setVisibility(!(whitelist_wifi || whitelist_other) && hintWhitelist ? View.VISIBLE : View.GONE);
} else if ("manage_system".equals(name)) {
invalidateOptionsMenu();
updateApplicationList(null);
LinearLayout llSystem = (LinearLayout) findViewById(R.id.llSystem);
boolean system = prefs.getBoolean("manage_system", false);
boolean hint = prefs.getBoolean("hint_system", true);

View File

@ -41,6 +41,33 @@
android:scrollbars="vertical" />
</android.support.v4.widget.SwipeRefreshLayout>
<LinearLayout
android:id="@+id/llWhitelist"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:padding="8dp">
<TextView
android:id="@+id/tvWhitelist"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_weight="1"
android:text="@string/msg_whitelist"
android:textAppearance="@style/TextSmall" />
<Button
android:id="@+id/btnWhitelist"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginLeft="8dp"
android:layout_marginStart="8dp"
android:text="@android:string/ok"
android:textAppearance="@style/TextSmall" />
</LinearLayout>
<LinearLayout
android:id="@+id/llSystem"
android:layout_width="match_parent"

View File

@ -180,7 +180,8 @@ Your internet traffic is not being sent to a remote VPN server.</string>
<string name="msg_metered">Network is metered</string>
<string name="msg_queue">NetGuard is busy</string>
<string name="msg_update">Update available, tap to download</string>
<string name="msg_system">Managing system applications can be enabled in the advanced options</string>
<string name="msg_whitelist">Internet access is allowed by default, this can be changed in the settings</string>
<string name="msg_system">Managing system applications can be enabled in the settings</string>
<string name="msg_issue">Please describe the problem and indicate the time of the problem:</string>
<string name="title_unmetered_allowed">Unmetered traffic is allowed</string>