Skip to content

Commit

Permalink
Update setting_hide_menu.md
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaoxu8 authored Mar 22, 2017
1 parent 677c8df commit a2840c4
Showing 1 changed file with 49 additions and 1 deletion.
50 changes: 49 additions & 1 deletion setting_hide_menu.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,52 @@ settings所有项目的布局加载文件为xml/dash_category.xml,如果想要
updateTilesList(categories);
}

-
- 先调用loadCagegoriesFromResource加载该布局,然后有个updateTilesList(categories)的过程,接下来我们关注这个点

final boolean showDev = mDevelopmentPreferences.getBoolean(
DevelopmentSettings.PREF_SHOW,
android.os.Build.TYPE.equals("eng"));

final UserManager um = (UserManager) getSystemService(Context.USER_SERVICE);

final int size = target.size();
for (int i = 0; i < size; i++) {

DashboardCategory category = target.get(i);

// Ids are integers, so downcasting is ok
int id = (int) category.id;
int n = category.getTilesCount() - 1;
while (n >= 0) {

DashboardTile tile = category.getTile(n);
boolean removeTile = false;
id = (int) tile.id;
if (id == R.id.operator_settings || id == R.id.manufacturer_settings) {
if (!Utils.updateTileToSpecificActivityFromMetaDataOrRemove(this, tile)) {
removeTile = true;
}
} else if (id == R.id.wifi_settings) {
// Remove WiFi Settings if WiFi service is not available.
if (!getPackageManager().hasSystemFeature(PackageManager.FEATURE_WIFI)) {
removeTile = true;
}
} else if (id == R.id.bluetooth_settings) {
// Remove Bluetooth Settings if Bluetooth service is not available.
if (!getPackageManager().hasSystemFeature(PackageManager.FEATURE_BLUETOOTH)) {
removeTile = true;
}
} else if (id == R.id.data_usage_settings) {
// Remove data usage when kernel module not enabled
final INetworkManagementService netManager = INetworkManagementService.Stub
.asInterface(ServiceManager.getService(Context.NETWORKMANAGEMENT_SERVICE));
.............................

} else if (id == R.id.privacy_settings) {
removeTile = true;
} else if (id == R.id.apps_compatibility_settings) {
removeTile = true;
} else if (id == R.id.jabol_settings) {
removeTile = true;
里边有个判断,如果是这个Id,我们对removeTile有个赋值操作,为true则表示在Settings的布局不再显示该条目,达到隐藏的目的。

0 comments on commit a2840c4

Please sign in to comment.