Added Android code
[wl-app.git] / Android / folioreader / src / main / java / com / folioreader / model / quickaction / ActionItem.java
1 package com.folioreader.model.quickaction;
2
3 import android.graphics.Bitmap;
4 import android.graphics.drawable.Drawable;
5
6 /**
7  * Action item, displayed as menu with mIcon and text.
8  *
9  * @author Lorensius. W. L. T <lorenz@londatiga.net>
10  *
11  *         Contributors:
12  *         - Kevin Peck <kevinwpeck@gmail.com>
13  */
14 public class ActionItem {
15     private Drawable mIcon;
16     private Bitmap mThumb;
17     private String mTitle;
18     private int mActionId = -1;
19     private boolean mSelected;
20     private boolean mSticky;
21
22     /**
23      * Constructor
24      *
25      * @param mActionId Action id for case statements
26      * @param mTitle    Title
27      * @param mIcon     Icon to use
28      */
29     public ActionItem(int mActionId, String mTitle, Drawable mIcon) {
30         this.mTitle = mTitle;
31         this.mIcon = mIcon;
32         this.mActionId = mActionId;
33     }
34
35     /**
36      * Constructor
37      */
38     public ActionItem() {
39         this(-1, null, null);
40     }
41
42     /**
43      * Constructor
44      *
45      * @param mActionId Action id of the item
46      * @param mTitle    Text to show for the item
47      */
48     public ActionItem(int mActionId, String mTitle) {
49         this(mActionId, mTitle, null);
50     }
51
52     /**
53      * Constructor
54      *
55      * @param mIcon {@link Drawable} action mIcon
56      */
57     public ActionItem(Drawable mIcon) {
58         this(-1, null, mIcon);
59     }
60
61     /**
62      * Constructor
63      *
64      * @param mActionId Action ID of item
65      * @param mIcon     {@link Drawable} action mIcon
66      */
67     public ActionItem(int mActionId, Drawable mIcon) {
68         this(mActionId, null, mIcon);
69     }
70
71     /**
72      * Set action mTitle
73      *
74      * @param mTitle action mTitle
75      */
76     public void setTitle(String mTitle) {
77         this.mTitle = mTitle;
78     }
79
80     /**
81      * Get action mTitle
82      *
83      * @return action mTitle
84      */
85     public String getTitle() {
86         return this.mTitle;
87     }
88
89     /**
90      * Set action mIcon
91      *
92      * @param mIcon {@link Drawable} action mIcon
93      */
94     public void setIcon(Drawable mIcon) {
95         this.mIcon = mIcon;
96     }
97
98     /**
99      * Get action mIcon
100      *
101      * @return {@link Drawable} action mIcon
102      */
103     public Drawable getIcon() {
104         return this.mIcon;
105     }
106
107     /**
108      * Set action id
109      *
110      * @param mActionId Action id for this action
111      */
112     public void setActionId(int mActionId) {
113         this.mActionId = mActionId;
114     }
115
116     /**
117      * @return Our action id
118      */
119     public int getActionId() {
120         return mActionId;
121     }
122
123     /**
124      * Set mSticky status of button
125      *
126      * @param mSticky true for mSticky, pop up sends event but does not disappear
127      */
128     public void setSticky(boolean mSticky) {
129         this.mSticky = mSticky;
130     }
131
132     /**
133      * @return true if button is mSticky, menu stays visible after press
134      */
135     public boolean isSticky() {
136         return mSticky;
137     }
138
139     /**
140      * Set mSelected flag;
141      *
142      * @param mSelected Flag to indicate the item is mSelected
143      */
144     public void setSelected(boolean mSelected) {
145         this.mSelected = mSelected;
146     }
147
148     /**
149      * Check if item is mSelected
150      *
151      * @return true or false
152      */
153     public boolean isSelected() {
154         return this.mSelected;
155     }
156
157     /**
158      * Set mThumb
159      *
160      * @param mThumb Thumb image
161      */
162     public void setThumb(Bitmap mThumb) {
163         this.mThumb = mThumb;
164     }
165
166     /**
167      * Get mThumb image
168      *
169      * @return Thumb image
170      */
171     public Bitmap getThumb() {
172         return this.mThumb;
173     }
174 }