Hide sort menu when traffic stats unsupported

Refs #489
This commit is contained in:
M66B 2017-03-23 11:55:58 +01:00
parent cb52caa8b1
commit 2c4fa816e7
2 changed files with 12 additions and 9 deletions

View File

@ -72,14 +72,6 @@
<sourceFolder url="file://$MODULE_DIR$/src/all/java" isTestSource="false" /> <sourceFolder url="file://$MODULE_DIR$/src/all/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/all/renderscript" 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/all/shaders" isTestSource="false" />
<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" />
<sourceFolder url="file://$MODULE_DIR$/src/testAll/aidl" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/testAll/java" isTestSource="true" />
<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/res" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTestAll/resources" 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/assets" type="java-test-resource" />
@ -88,6 +80,14 @@
<sourceFolder url="file://$MODULE_DIR$/src/androidTestAll/jni" 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/rs" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTestAll/shaders" 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" />
<sourceFolder url="file://$MODULE_DIR$/src/testAll/aidl" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/testAll/java" isTestSource="true" />
<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/debug/res" type="java-resource" /> <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/resources" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/assets" type="java-resource" /> <sourceFolder url="file://$MODULE_DIR$/src/debug/assets" type="java-resource" />

View File

@ -29,11 +29,13 @@ import android.content.pm.PackageManager;
import android.content.res.Configuration; import android.content.res.Configuration;
import android.graphics.Color; import android.graphics.Color;
import android.graphics.drawable.Drawable; import android.graphics.drawable.Drawable;
import android.net.TrafficStats;
import android.net.Uri; import android.net.Uri;
import android.net.VpnService; import android.net.VpnService;
import android.os.AsyncTask; import android.os.AsyncTask;
import android.os.Build; import android.os.Build;
import android.os.Handler; import android.os.Handler;
import android.os.Process;
import android.preference.PreferenceManager; import android.preference.PreferenceManager;
import android.provider.Settings; import android.provider.Settings;
import android.support.annotation.NonNull; import android.support.annotation.NonNull;
@ -751,7 +753,8 @@ public class ActivityMain extends AppCompatActivity implements SharedPreferences
menu.findItem(R.id.menu_app_nointernet).setChecked(prefs.getBoolean("show_nointernet", true)); menu.findItem(R.id.menu_app_nointernet).setChecked(prefs.getBoolean("show_nointernet", true));
menu.findItem(R.id.menu_app_disabled).setChecked(prefs.getBoolean("show_disabled", true)); menu.findItem(R.id.menu_app_disabled).setChecked(prefs.getBoolean("show_disabled", true));
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N ||
TrafficStats.getUidRxBytes(Process.SYSTEM_UID) == TrafficStats.UNSUPPORTED) {
Menu submenu = menu.findItem(R.id.menu_sort).getSubMenu(); Menu submenu = menu.findItem(R.id.menu_sort).getSubMenu();
submenu.removeItem(R.id.menu_sort_data); submenu.removeItem(R.id.menu_sort_data);
} }