~defrager/financisto/lightTheme

« back to all changes in this revision

Viewing changes to GreenDroid/src/greendroid/widget/NormalActionBarItem.java

  • Committer: Denis Solonenko
  • Date: 2011-07-30 14:42:59 UTC
  • mfrom: (193.1.28 financisto)
  • Revision ID: denis.solonenko@gmail.com-20110730144259-gyf9f3rnpb6d2v9q
MergedĀ fromĀ lp:~denis-solonenko/financisto/sandbox

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright (C) 2010 Cyril Mottier (http://www.cyrilmottier.com)
 
3
 *
 
4
 * Licensed under the Apache License, Version 2.0 (the "License");
 
5
 * you may not use this file except in compliance with the License.
 
6
 * You may obtain a copy of the License at
 
7
 *
 
8
 *      http://www.apache.org/licenses/LICENSE-2.0
 
9
 *
 
10
 * Unless required by applicable law or agreed to in writing, software
 
11
 * distributed under the License is distributed on an "AS IS" BASIS,
 
12
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 
13
 * See the License for the specific language governing permissions and
 
14
 * limitations under the License.
 
15
 */
 
16
package greendroid.widget;
 
17
 
 
18
import android.view.LayoutInflater;
 
19
import android.view.View;
 
20
import android.widget.ImageButton;
 
21
 
 
22
import com.cyrilmottier.android.greendroid.R;
 
23
 
 
24
/**
 
25
 * Default implementation of an {@link ActionBarItem}. A
 
26
 * {@link NormalActionBarItem} is a simple {@link ActionBarItem} containing a
 
27
 * single icon.
 
28
 * 
 
29
 * @author Cyril Mottier
 
30
 */
 
31
public class NormalActionBarItem extends ActionBarItem {
 
32
 
 
33
    @Override
 
34
    protected View createItemView() {
 
35
        return LayoutInflater.from(mContext).inflate(R.layout.gd_action_bar_item_base, mActionBar, false);
 
36
    }
 
37
 
 
38
    @Override
 
39
    protected void prepareItemView() {
 
40
        super.prepareItemView();
 
41
        final ImageButton imageButton = (ImageButton) mItemView.findViewById(R.id.gd_action_bar_item);
 
42
        imageButton.setImageDrawable(mDrawable);
 
43
        imageButton.setContentDescription(mContentDescription);
 
44
    }
 
45
 
 
46
    @Override
 
47
    protected void onContentDescriptionChanged() {
 
48
        super.onContentDescriptionChanged();
 
49
        mItemView.findViewById(R.id.gd_action_bar_item).setContentDescription(mContentDescription);
 
50
    }
 
51
 
 
52
    @Override
 
53
    protected void onDrawableChanged() {
 
54
        super.onDrawableChanged();
 
55
        ImageButton imageButton = (ImageButton) mItemView.findViewById(R.id.gd_action_bar_item);
 
56
        imageButton.setImageDrawable(mDrawable);
 
57
    }
 
58
 
 
59
}