2
* Copyright (C) 2010 Cyril Mottier (http://www.cyrilmottier.com)
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
8
* http://www.apache.org/licenses/LICENSE-2.0
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.
16
package greendroid.widget;
18
import android.view.LayoutInflater;
19
import android.view.View;
20
import android.widget.ImageButton;
22
import com.cyrilmottier.android.greendroid.R;
25
* Default implementation of an {@link ActionBarItem}. A
26
* {@link NormalActionBarItem} is a simple {@link ActionBarItem} containing a
29
* @author Cyril Mottier
31
public class NormalActionBarItem extends ActionBarItem {
34
protected View createItemView() {
35
return LayoutInflater.from(mContext).inflate(R.layout.gd_action_bar_item_base, mActionBar, false);
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);
47
protected void onContentDescriptionChanged() {
48
super.onContentDescriptionChanged();
49
mItemView.findViewById(R.id.gd_action_bar_item).setContentDescription(mContentDescription);
53
protected void onDrawableChanged() {
54
super.onDrawableChanged();
55
ImageButton imageButton = (ImageButton) mItemView.findViewById(R.id.gd_action_bar_item);
56
imageButton.setImageDrawable(mDrawable);