Wed, 31 Dec 2014 07:22:50 +0100
Correct previous dual key logic pending first delivery installment.
1 /* -*- Mode: Java; c-basic-offset: 4; tab-width: 20; indent-tabs-mode: nil; -*-
2 * This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 package org.mozilla.gecko.home;
8 import org.mozilla.gecko.R;
10 import android.content.Context;
11 import android.util.AttributeSet;
12 import android.widget.TextView;
14 public class BookmarkFolderView extends TextView {
15 private static final int[] STATE_OPEN = { R.attr.state_open };
17 private boolean mIsOpen = false;
19 public BookmarkFolderView(Context context) {
20 super(context);
21 }
23 public BookmarkFolderView(Context context, AttributeSet attrs) {
24 super(context, attrs);
25 }
27 public BookmarkFolderView(Context context, AttributeSet attrs, int defStyle) {
28 super(context, attrs, defStyle);
29 }
31 @Override
32 public int[] onCreateDrawableState(int extraSpace) {
33 final int[] drawableState = super.onCreateDrawableState(extraSpace + 1);
35 if (mIsOpen) {
36 mergeDrawableStates(drawableState, STATE_OPEN);
37 }
39 return drawableState;
40 }
42 public void open() {
43 if (!mIsOpen) {
44 mIsOpen = true;
45 refreshDrawableState();
46 }
47 }
49 public void close() {
50 if (mIsOpen) {
51 mIsOpen = false;
52 refreshDrawableState();
53 }
54 }
55 }