OLD | NEW |
(Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 package org.chromium.chrome.browser.ntp.cards; |
| 6 |
| 7 /** |
| 8 * A node in the tree that has a parent and can notify it about changes. |
| 9 * |
| 10 * This class mostly serves as a convenience base class for implementations of {
@link TreeNode}. |
| 11 */ |
| 12 public abstract class ChildNode implements TreeNode { |
| 13 private final NodeParent mParent; |
| 14 |
| 15 protected ChildNode(NodeParent parent) { |
| 16 mParent = parent; |
| 17 } |
| 18 |
| 19 protected void notifyItemRangeChanged(int index, int count) { |
| 20 mParent.onItemRangeChanged(this, index, count); |
| 21 } |
| 22 |
| 23 protected void notifyItemRangeInserted(int index, int count) { |
| 24 mParent.onItemRangeInserted(this, index, count); |
| 25 } |
| 26 |
| 27 protected void notifyItemRangeRemoved(int index, int count) { |
| 28 mParent.onItemRangeRemoved(this, index, count); |
| 29 } |
| 30 |
| 31 protected void notifyItemChanged(int index) { |
| 32 notifyItemRangeChanged(index, 1); |
| 33 } |
| 34 |
| 35 protected void notifyItemInserted(int index) { |
| 36 notifyItemRangeInserted(index, 1); |
| 37 } |
| 38 |
| 39 protected void notifyItemRemoved(int index) { |
| 40 notifyItemRangeRemoved(index, 1); |
| 41 } |
| 42 } |
OLD | NEW |