From c978a553897f8525754fc11cfefbca3196a608dc Mon Sep 17 00:00:00 2001 From: Adnan Begovic Date: Mon, 23 Feb 2015 15:19:00 -0800 Subject: Settings: Clean up code style in ButtonSettings Change-Id: I6df0ee12536dcca2b9734785bebe16a0fea7f0c2 --- src/com/android/settings/ButtonSettings.java | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) (limited to 'src') diff --git a/src/com/android/settings/ButtonSettings.java b/src/com/android/settings/ButtonSettings.java index 95bb3d9..ee81bcd 100644 --- a/src/com/android/settings/ButtonSettings.java +++ b/src/com/android/settings/ButtonSettings.java @@ -189,7 +189,8 @@ public class ButtonSettings extends SettingsPreferenceFragment implements mNavigationBarLeftPref = (SwitchPreference) findPreference(KEY_NAVIGATION_BAR_LEFT); // Navigation bar recents long press activity needs custom setup - mNavigationRecentsLongPressAction = initRecentsLongPressAction(KEY_NAVIGATION_RECENTS_LONG_PRESS); + mNavigationRecentsLongPressAction = + initRecentsLongPressAction(KEY_NAVIGATION_RECENTS_LONG_PRESS); // Only visible on devices that does not have a navigation bar already, // and don't even try unless the existing keys can be disabled @@ -425,15 +426,17 @@ public class ButtonSettings extends SettingsPreferenceFragment implements targetComponent = ComponentName.unflattenFromString(componentString); } - // Dyanamically generate the list array, query PackageManager for all Activites that are registered for - // ACTION_RECENTS_LONG_PRESS + // Dyanamically generate the list array, + // query PackageManager for all Activites that are registered for ACTION_RECENTS_LONG_PRESS PackageManager pm = getPackageManager(); Intent intent = new Intent(Intent.ACTION_RECENTS_LONG_PRESS); - List recentsActivities = pm.queryIntentActivities(intent, PackageManager.MATCH_DEFAULT_ONLY); + List recentsActivities = pm.queryIntentActivities(intent, + PackageManager.MATCH_DEFAULT_ONLY); if (recentsActivities.size() == 0) { // No entries available, disable list.setSummary(getString(R.string.hardware_keys_action_last_app)); - Settings.Secure.putString(getContentResolver(), Settings.Secure.RECENTS_LONG_PRESS_ACTIVITY, null); + Settings.Secure.putString(getContentResolver(), + Settings.Secure.RECENTS_LONG_PRESS_ACTIVITY, null); list.setEnabled(false); return list; } @@ -447,8 +450,8 @@ public class ButtonSettings extends SettingsPreferenceFragment implements int i = 1; for (ResolveInfo info : recentsActivities) { try { - // Use pm.getApplicationInfo for the label, we cannot rely on ResolveInfo that comes back from - // queryIntentActivities. + // Use pm.getApplicationInfo for the label, + // we cannot rely on ResolveInfo that comes back from queryIntentActivities. entries[i] = pm.getApplicationInfo(info.activityInfo.packageName, 0).loadLabel(pm); } catch (PackageManager.NameNotFoundException e) { Log.e(TAG, "Error package not found: " + info.activityInfo.packageName, e); @@ -457,7 +460,8 @@ public class ButtonSettings extends SettingsPreferenceFragment implements } // Set the value to the ComponentName that will handle this intent - ComponentName entryComponent = new ComponentName(info.activityInfo.packageName, info.activityInfo.name); + ComponentName entryComponent = new ComponentName(info.activityInfo.packageName, + info.activityInfo.name); values[i] = entryComponent.flattenToString(); if (targetComponent != null) { if (entryComponent.equals(targetComponent)) { @@ -524,8 +528,8 @@ public class ButtonSettings extends SettingsPreferenceFragment implements Settings.System.VOLUME_KEY_CURSOR_CONTROL); return true; } else if (preference == mNavigationRecentsLongPressAction) { - // RecentsLongPressAction is handled differently because it intentionally uses Settings. - // Settings.System. + // RecentsLongPressAction is handled differently because it intentionally uses + // Settings.System String putString = (String) newValue; int index = mNavigationRecentsLongPressAction.findIndexOfValue(putString); CharSequence summary = mNavigationRecentsLongPressAction.getEntries()[index]; @@ -534,7 +538,8 @@ public class ButtonSettings extends SettingsPreferenceFragment implements if (putString.length() == 0) { putString = null; } - Settings.Secure.putString(getContentResolver(), Settings.Secure.RECENTS_LONG_PRESS_ACTIVITY, putString); + Settings.Secure.putString(getContentResolver(), + Settings.Secure.RECENTS_LONG_PRESS_ACTIVITY, putString); return true; } return false; -- cgit v1.1