Add dependency support to ListPreferenceSummary.
Disable dependent views if value is "0".
This commit is contained in:
parent
068352505c
commit
a8f84d85b4
@ -1,4 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2018 Adrian Ulrich <adrian@blinkenlights.ch>
|
||||
* Copyright (C) 2011 Christopher Eby <kreed@kreed.org>
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
@ -44,10 +45,17 @@ public class ListPreferenceSummary extends ListPreference {
|
||||
return getEntry();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldDisableDependents()
|
||||
{
|
||||
return getValue().equals("0");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDialogClosed(boolean positiveResult)
|
||||
{
|
||||
super.onDialogClosed(positiveResult);
|
||||
notifyDependencyChange(shouldDisableDependents());
|
||||
notifyChanged();
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user