OC-1833: Add CustomButton class to can change the background of buttons
[pub/Android/ownCloud.git] / src / de / mobilcom / debitel / cloud / android / ui / CustomButton.java
1 package de.mobilcom.debitel.cloud.android.ui;
2
3 import de.mobilcom.debitel.cloud.android.R;
4 import android.content.Context;
5 import android.util.AttributeSet;
6 import android.widget.Button;
7 /**
8 * @author masensio
9 *
10 * Button for customizing the button background
11 */
12
13 public class CustomButton extends Button {
14
15 public CustomButton(Context context) {
16 super(context);
17
18 boolean customButtons = getResources().getBoolean(R.bool.custom_buttons);
19 if (customButtons)
20 {
21 this.setBackgroundResource(R.drawable.btn_default);
22 }
23 }
24
25 public CustomButton(Context context, AttributeSet attrs) {
26 super(context, attrs);
27
28 boolean customButtons = getResources().getBoolean(R.bool.custom_buttons);
29 if (customButtons)
30 {
31 this.setBackgroundResource(R.drawable.btn_default);
32 }
33 }
34
35 public CustomButton(Context context, AttributeSet attrs, int defStyle) {
36 super(context, attrs, defStyle);
37
38 boolean customButtons = getResources().getBoolean(R.bool.custom_buttons);
39 if (customButtons)
40 {
41 this.setBackgroundResource(R.drawable.btn_default);
42 }
43 }
44
45 }