Make 3rd party AppCompatListPreference adhere to our checkstyle rules.

Added braces around one line if statements.
This commit is contained in:
Peter Serwylo 2017-02-20 08:47:59 +11:00
parent 79ecffc91c
commit 81aacac592

View File

@ -63,8 +63,9 @@ public class AppCompatListPreference extends ListPreference {
public void onClick(DialogInterface dialog, int which) { public void onClick(DialogInterface dialog, int which) {
if (which >= 0 && getEntryValues() != null) { if (which >= 0 && getEntryValues() != null) {
String value = getEntryValues()[which].toString(); String value = getEntryValues()[which].toString();
if (callChangeListener(value) && isPersistent()) if (callChangeListener(value) && isPersistent()) {
setValue(value); setValue(value);
}
} }
dialog.dismiss(); dialog.dismiss();
} }
@ -82,8 +83,9 @@ public class AppCompatListPreference extends ListPreference {
} }
mDialog = builder.create(); mDialog = builder.create();
if (state != null) if (state != null) {
mDialog.onRestoreInstanceState(state); mDialog.onRestoreInstanceState(state);
}
mDialog.show(); mDialog.show();
} }
@ -91,7 +93,8 @@ public class AppCompatListPreference extends ListPreference {
public void onActivityDestroy() { public void onActivityDestroy() {
super.onActivityDestroy(); super.onActivityDestroy();
if (mDialog != null && mDialog.isShowing() && if (mDialog != null && mDialog.isShowing() &&
mDialog.getWindow() != null && mDialog.getWindow().getWindowManager() != null) mDialog.getWindow() != null && mDialog.getWindow().getWindowManager() != null) {
mDialog.dismiss(); mDialog.dismiss();
}
} }
} }