Merge "Remove unnecessary notify in BT preference"

This commit is contained in:
TreeHugger Robot
2019-04-02 19:36:30 +00:00
committed by Android (Google) Code Review
4 changed files with 27 additions and 12 deletions

View File

@@ -31,6 +31,7 @@ import android.util.Pair;
import android.util.TypedValue;
import android.widget.ImageView;
import androidx.annotation.VisibleForTesting;
import androidx.appcompat.app.AlertDialog;
import androidx.preference.Preference;
import androidx.preference.PreferenceViewHolder;
@@ -59,6 +60,8 @@ public final class BluetoothDevicePreference extends GearPreference implements
private AlertDialog mDisconnectDialog;
private String contentDescription = null;
private boolean mHideSecondTarget = false;
@VisibleForTesting
boolean mNeedNotifyHierarchyChanged = false;
/* Talk-back descriptions for various BT icons */
Resources mResources;
@@ -81,8 +84,8 @@ public final class BluetoothDevicePreference extends GearPreference implements
onDeviceAttributesChanged();
}
void rebind() {
notifyChanged();
public void setNeedNotifyHierarchyChanged(boolean needNotifyHierarchyChanged) {
mNeedNotifyHierarchyChanged = needNotifyHierarchyChanged;
}
@Override
@@ -145,7 +148,9 @@ public final class BluetoothDevicePreference extends GearPreference implements
setVisible(mShowDevicesWithoutNames || mCachedDevice.hasHumanReadableName());
// This could affect ordering, so notify that
notifyHierarchyChanged();
if (mNeedNotifyHierarchyChanged) {
notifyHierarchyChanged();
}
}
@Override