Skip to content

Commit 1b47b1f

Browse files
Merge pull request #187 from Bearded-Hen/develop
Develop
2 parents 81df981 + 0bf4601 commit 1b47b1f

26 files changed

+228
-162
lines changed

AndroidBootstrap/build.gradle

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,18 @@ apply plugin: 'com.android.library'
22
apply from: 'push.gradle'
33

44
android {
5-
compileSdkVersion 23
6-
buildToolsVersion "23.0.3"
5+
compileSdkVersion Integer.parseInt(TARGET_SDK_INT)
6+
buildToolsVersion "25.0.1"
77

88
defaultConfig {
9-
minSdkVersion 14
10-
targetSdkVersion 23
9+
minSdkVersion Integer.parseInt(MIN_SDK_INT)
10+
targetSdkVersion Integer.parseInt(TARGET_SDK_INT)
1111
versionCode = Integer.parseInt(VERSION_CODE)
1212
versionName = VERSION_NAME
1313
}
1414
}
1515

1616
dependencies {
17-
compile 'com.android.support:support-annotations:23.3.0'
18-
compile 'com.android.support:support-v4:23.3.0'
17+
compile 'com.android.support:support-annotations:25.0.1'
18+
compile 'com.android.support:support-v4:25.0.1'
1919
}

AndroidBootstrap/src/main/java/com/beardedhen/androidbootstrap/AwesomeTextView.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,11 +113,13 @@ private void initialise(AttributeSet attrs) {
113113
markdownText = a.getString(R.styleable.AwesomeTextView_bootstrapText);
114114

115115
setClickable(clickable); // allows view to reach android:state_pressed
116+
117+
int gravity = a.getInt(R.styleable.AwesomeTextView_android_gravity, Gravity.CENTER);
118+
setGravity(gravity);
116119
}
117120
finally {
118121
a.recycle();
119122
}
120-
setGravity(Gravity.CENTER);
121123

122124
if (markdownText != null) {
123125
setMarkdownText(markdownText);

AndroidBootstrap/src/main/java/com/beardedhen/androidbootstrap/BootstrapButton.java

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package com.beardedhen.androidbootstrap;
22

33
import android.content.Context;
4-
import android.content.DialogInterface;
54
import android.content.res.TypedArray;
65
import android.graphics.drawable.Drawable;
76
import android.os.Bundle;
@@ -10,7 +9,6 @@
109
import android.support.annotation.Nullable;
1110
import android.util.AttributeSet;
1211
import android.view.MotionEvent;
13-
import android.view.View;
1412
import android.view.ViewParent;
1513

1614
import com.beardedhen.androidbootstrap.api.attributes.BootstrapBrand;
@@ -221,17 +219,12 @@ public void setSelected(boolean selected) {
221219

222220
private boolean handleRadioEvent(@NonNull MotionEvent event) {
223221
if (event.getAction() == MotionEvent.ACTION_DOWN) {
224-
if (isSelected()) {
225-
setSelected(false);
226-
}
227-
else { // notify parent to deselect any peers
228-
setSelected(true);
222+
setSelected(true); // notify parent to deselect any peers
229223

230-
ViewParent parent = getParent();
224+
ViewParent parent = getParent();
231225

232-
if (parent instanceof BootstrapButtonGroup) {
233-
((BootstrapButtonGroup) parent).onRadioToggle(parentIndex);
234-
}
226+
if (parent instanceof BootstrapButtonGroup) {
227+
((BootstrapButtonGroup) parent).onRadioToggle(parentIndex);
235228
}
236229
return true;
237230
}

AndroidBootstrap/src/main/java/com/beardedhen/androidbootstrap/BootstrapDropDown.java

Lines changed: 28 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ public class BootstrapDropDown extends AwesomeTextView implements View.OnClickLi
5151
private static final String REPLACE_REGEX_HEADER = "\\{dropdown_header\\}";
5252
private static final String REPLACE_REGEX_SEPARATOR = "\\{dropdown_separator\\}";
5353
private static final String REPLACE_REGEX_DISABLED = "\\{dropdown_disabled\\}";
54+
private static final int SCREEN_WIDTH_GUESS = 1000;
5455

5556
private ExpandDirection expandDirection;
5657
private PopupWindow dropdownWindow;
@@ -103,9 +104,16 @@ private void initialise(AttributeSet attrs) {
103104
int sizeOrdinal = a.getInt(R.styleable.BootstrapDropDown_bootstrapSize, -1);
104105

105106
expandDirection = ExpandDirection.fromAttributeValue(directionOrdinal);
106-
dropdownData = getContext().getResources().getStringArray(dataOrdinal);
107+
107108
bootstrapSize = DefaultBootstrapSize.fromAttributeValue(sizeOrdinal).scaleFactor();
108109
itemHeight = a.getDimensionPixelSize(R.styleable.BootstrapDropDown_itemHeight, (int) DimenUtils.pixelsFromDpResource(getContext(), R.dimen.bootstrap_dropdown_default_item_height));
110+
111+
if (isInEditMode()) {
112+
dropdownData = new String[] {"Android Studio", "Layout Preview", "Is Always", "Breaking"};
113+
}
114+
else {
115+
dropdownData = getContext().getResources().getStringArray(dataOrdinal);
116+
}
109117
}
110118
finally {
111119
a.recycle();
@@ -120,9 +128,14 @@ private void initialise(AttributeSet attrs) {
120128
baselineVertPadding = DimenUtils.pixelsFromDpResource(getContext(), R.dimen.bootstrap_button_default_vert_padding);
121129
baselineHoriPadding = DimenUtils.pixelsFromDpResource(getContext(), R.dimen.bootstrap_button_default_hori_padding);
122130

123-
DisplayMetrics metrics = new DisplayMetrics();
124-
((WindowManager) getContext().getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay().getMetrics(metrics);
125-
screenWidth = metrics.widthPixels;
131+
if (isInEditMode()) {
132+
screenWidth = SCREEN_WIDTH_GUESS; // take a sensible guess
133+
}
134+
else {
135+
DisplayMetrics metrics = new DisplayMetrics();
136+
((WindowManager) getContext().getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay().getMetrics(metrics);
137+
screenWidth = metrics.widthPixels;
138+
}
126139

127140
createDropDown();
128141
updateDropDownState();
@@ -133,8 +146,12 @@ private void createDropDown() {
133146
dropdownWindow = new PopupWindow();
134147
dropdownWindow.setFocusable(true);
135148
dropdownWindow.setHeight(WindowManager.LayoutParams.WRAP_CONTENT);
136-
dropdownWindow.setBackgroundDrawable(DrawableUtils.resolveDrawable(android.R.drawable
137-
.dialog_holo_light_frame, getContext()));
149+
150+
if (!isInEditMode()) {
151+
dropdownWindow.setBackgroundDrawable(DrawableUtils.resolveDrawable(android.R.drawable
152+
.dialog_holo_light_frame, getContext()));
153+
}
154+
138155
dropdownWindow.setContentView(dropdownView);
139156
dropdownWindow.setOnDismissListener(this);
140157
dropdownWindow.setAnimationStyle(android.R.style.Animation_Activity);
@@ -155,14 +172,16 @@ private ScrollView createDropDownView() {
155172
int clickableChildCounter = 0;
156173

157174
dropdownView.setOrientation(LinearLayout.VERTICAL);
158-
LayoutParams childParams = new LayoutParams(LayoutParams.MATCH_PARENT, DimenUtils.pixelsToDp(itemHeight * bootstrapSize));
175+
int height = (int) (itemHeight * bootstrapSize);
176+
LayoutParams childParams = new LayoutParams(LayoutParams.MATCH_PARENT, height);
159177

160178
for (String text : dropdownData) {
161179
TextView childView = new TextView(getContext());
162180
childView.setGravity(Gravity.CENTER_VERTICAL);
163181
childView.setLayoutParams(childParams);
164-
childView.setPadding(DimenUtils.dpToPixels(baselineItemLeftPadding * bootstrapSize), 0,
165-
DimenUtils.dpToPixels(baselineItemRightPadding * bootstrapSize), 0);
182+
183+
int padding = (int) (baselineItemLeftPadding * bootstrapSize);
184+
childView.setPadding(padding, 0, padding, 0);
166185
childView.setTextSize(baselineDropDownViewFontSize * bootstrapSize);
167186
childView.setTextColor(ColorUtils.resolveColor(android.R.color.black, getContext()));
168187

AndroidBootstrap/src/main/java/com/beardedhen/androidbootstrap/BootstrapLabel.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ private void initialise(AttributeSet attrs) {
4949

5050
try {
5151
int attrValue = a.getInt(R.styleable.BootstrapLabel_bootstrapHeading, 5);
52-
this.roundable = a.getBoolean(R.styleable.BootstrapButton_roundedCorners, false);
52+
this.roundable = a.getBoolean(R.styleable.BootstrapLabel_roundedCorners, false);
5353

5454
this.bootstrapHeading = DefaultBootstrapHeading.fromAttributeValue(attrValue);
5555
}

AndroidBootstrap/src/main/res/values/attrs.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@
6363
<attr name="typicon"/>
6464
<attr name="materialIcon" />
6565
<attr name="android:clickable" />
66+
<attr name="android:gravity" />
6667
</declare-styleable>
6768

6869
<declare-styleable name="BootstrapLabel">

LICENSE.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
The MIT License (MIT)
22

3-
Copyright (c) 2013-2015 Bearded Hen
3+
Copyright (c) 2013-2016 Bearded Hen
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy of
66
this software and associated documentation files (the "Software"), to deal in

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ buildscript {
44
mavenCentral()
55
}
66
dependencies {
7-
classpath 'com.android.tools.build:gradle:2.1.2'
7+
classpath 'com.android.tools.build:gradle:2.2.3'
88
}
99
}
1010

gradle.properties

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
1-
VERSION_NAME=2.3.0
2-
VERSION_CODE=230
1+
VERSION_NAME=2.3.1
2+
VERSION_CODE=231
33
GROUP=com.beardedhen
44

5+
MIN_SDK_INT=14
6+
TARGET_SDK_INT=25
7+
58
POM_DESCRIPTION=Bootstrap style widgets for Android, with Glyph Icons
69
POM_URL=https://github.com/Bearded-Hen/Android-Bootstrap
710
POM_SCM_URL=https://github.com/Bearded-Hen/Android-Bootstrap

sample/build.gradle

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
apply plugin: 'com.android.application'
22

33
android {
4-
compileSdkVersion 23
5-
buildToolsVersion "23.0.3"
4+
compileSdkVersion Integer.parseInt(TARGET_SDK_INT)
5+
buildToolsVersion "25.0.1"
66

77
defaultConfig {
88
applicationId "com.fractalwrench.androidbootstrap.sample"
9-
minSdkVersion 14
10-
targetSdkVersion 23
9+
minSdkVersion Integer.parseInt(MIN_SDK_INT)
10+
targetSdkVersion Integer.parseInt(TARGET_SDK_INT)
1111
versionCode = Integer.parseInt(VERSION_CODE)
1212
versionName = VERSION_NAME
1313
}
@@ -28,7 +28,9 @@ android {
2828
dependencies {
2929
compile project (':AndroidBootstrap') // replace with Maven dependency in your app
3030

31-
compile 'com.jakewharton:butterknife:7.0.1'
32-
compile 'com.android.support:appcompat-v7:23.4.0'
33-
compile 'com.android.support:support-annotations:23.4.0'
31+
compile 'com.jakewharton:butterknife:8.4.0'
32+
annotationProcessor 'com.jakewharton:butterknife-compiler:8.4.0'
33+
34+
compile 'com.android.support:appcompat-v7:25.0.1'
35+
compile 'com.android.support:support-annotations:25.0.1'
3436
}

sample/src/main/java/com/fractalwrench/androidbootstrap/sample/AwesomeTextViewExample.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import com.beardedhen.androidbootstrap.BootstrapText;
77
import com.beardedhen.androidbootstrap.font.MaterialIcons;
88

9-
import butterknife.Bind;
9+
import butterknife.BindView;
1010
import butterknife.OnClick;
1111

1212
import static com.beardedhen.androidbootstrap.font.FontAwesome.FA_ANCHOR;
@@ -22,12 +22,12 @@ public class AwesomeTextViewExample extends BaseActivity {
2222
return R.layout.example_awesome_text_view;
2323
}
2424

25-
@Bind(R.id.example_fa_text_change) AwesomeTextView exampleChange;
26-
@Bind(R.id.example_fa_text_flash) AwesomeTextView exampleFlash;
27-
@Bind(R.id.example_fa_text_rotate) AwesomeTextView exampleRotate;
28-
@Bind(R.id.example_fa_text_multi_change) AwesomeTextView exampleMultiChange;
29-
@Bind(R.id.example_fa_text_builder) AwesomeTextView exampleBuilder;
30-
@Bind(R.id.example_mix_and_match) AwesomeTextView mixAndMatch;
25+
@BindView(R.id.example_fa_text_change) AwesomeTextView exampleChange;
26+
@BindView(R.id.example_fa_text_flash) AwesomeTextView exampleFlash;
27+
@BindView(R.id.example_fa_text_rotate) AwesomeTextView exampleRotate;
28+
@BindView(R.id.example_fa_text_multi_change) AwesomeTextView exampleMultiChange;
29+
@BindView(R.id.example_fa_text_builder) AwesomeTextView exampleBuilder;
30+
@BindView(R.id.example_mix_and_match) AwesomeTextView mixAndMatch;
3131

3232
private boolean android = true;
3333
private boolean wikipedia = true;

sample/src/main/java/com/fractalwrench/androidbootstrap/sample/BootstrapAlertExample.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@
66

77
import com.beardedhen.androidbootstrap.BootstrapAlert;
88

9-
import butterknife.Bind;
9+
import butterknife.BindView;
1010
import butterknife.OnClick;
1111

1212
public class BootstrapAlertExample extends BaseActivity {
1313

1414
public static final String TAG = "BootstrapAlertExample";
1515

16-
@Bind(R.id.dynamic_alert) BootstrapAlert alert;
16+
@BindView(R.id.dynamic_alert) BootstrapAlert alert;
1717

1818
@Override
1919
protected int getContentLayoutId() {

sample/src/main/java/com/fractalwrench/androidbootstrap/sample/BootstrapBadgeExample.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@
77

88
import java.util.Random;
99

10-
import butterknife.Bind;
10+
import butterknife.BindView;
1111
import butterknife.OnClick;
1212

1313
public class BootstrapBadgeExample extends BaseActivity {
1414

15-
@Bind(R.id.xml_badge_button) BootstrapButton xmlBadgeButton;
16-
@Bind(R.id.java_badge_button) BootstrapButton javaBadgeButton;
17-
@Bind(R.id.lonely_badge) BootstrapBadge lonelyBadge;
15+
@BindView(R.id.xml_badge_button) BootstrapButton xmlBadgeButton;
16+
@BindView(R.id.java_badge_button) BootstrapButton javaBadgeButton;
17+
@BindView(R.id.lonely_badge) BootstrapBadge lonelyBadge;
1818

1919
@Override
2020
protected int getContentLayoutId() {

sample/src/main/java/com/fractalwrench/androidbootstrap/sample/BootstrapButtonExample.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
import com.beardedhen.androidbootstrap.api.defaults.DefaultBootstrapBrand;
88
import com.beardedhen.androidbootstrap.api.defaults.DefaultBootstrapSize;
99

10-
import butterknife.Bind;
10+
import butterknife.BindView;
1111
import butterknife.OnClick;
1212

1313
public class BootstrapButtonExample extends BaseActivity {
@@ -18,11 +18,11 @@ public class BootstrapButtonExample extends BaseActivity {
1818

1919
private DefaultBootstrapSize size = DefaultBootstrapSize.LG;
2020

21-
@Bind(R.id.bbutton_example_corners) BootstrapButton exampleCorners;
22-
@Bind(R.id.bbutton_example_outline) BootstrapButton exampleOutline;
23-
@Bind(R.id.bbutton_example_size) BootstrapButton exampleSize;
24-
@Bind(R.id.bbutton_example_theme) BootstrapButton exampleTheme;
25-
@Bind(R.id.example_bbutton_custom_style) BootstrapButton exampleCustomStyle;
21+
@BindView(R.id.bbutton_example_corners) BootstrapButton exampleCorners;
22+
@BindView(R.id.bbutton_example_outline) BootstrapButton exampleOutline;
23+
@BindView(R.id.bbutton_example_size) BootstrapButton exampleSize;
24+
@BindView(R.id.bbutton_example_theme) BootstrapButton exampleTheme;
25+
@BindView(R.id.example_bbutton_custom_style) BootstrapButton exampleCustomStyle;
2626

2727
@Override protected void onCreate(Bundle savedInstanceState) {
2828
super.onCreate(savedInstanceState);

sample/src/main/java/com/fractalwrench/androidbootstrap/sample/BootstrapButtonGroupExample.java

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
import com.beardedhen.androidbootstrap.api.defaults.DefaultBootstrapBrand;
1010
import com.beardedhen.androidbootstrap.api.defaults.DefaultBootstrapSize;
1111

12-
import butterknife.Bind;
12+
import butterknife.BindView;
1313
import butterknife.OnClick;
1414

1515
public class BootstrapButtonGroupExample extends BaseActivity {
@@ -20,18 +20,18 @@ public class BootstrapButtonGroupExample extends BaseActivity {
2020

2121
private DefaultBootstrapSize size = DefaultBootstrapSize.MD;
2222

23-
@Bind(R.id.bbutton_group_orientation_change) BootstrapButtonGroup orientationChange;
24-
@Bind(R.id.bbutton_group_size_change) BootstrapButtonGroup sizeChange;
25-
@Bind(R.id.bbutton_group_outline_change) BootstrapButtonGroup outlineChange;
26-
@Bind(R.id.bbutton_group_rounded_change) BootstrapButtonGroup roundedChange;
27-
@Bind(R.id.bbutton_group_brand_change) BootstrapButtonGroup brandChange;
28-
@Bind(R.id.bbutton_group_child_change) BootstrapButtonGroup childChange;
23+
@BindView(R.id.bbutton_group_orientation_change) BootstrapButtonGroup orientationChange;
24+
@BindView(R.id.bbutton_group_size_change) BootstrapButtonGroup sizeChange;
25+
@BindView(R.id.bbutton_group_outline_change) BootstrapButtonGroup outlineChange;
26+
@BindView(R.id.bbutton_group_rounded_change) BootstrapButtonGroup roundedChange;
27+
@BindView(R.id.bbutton_group_brand_change) BootstrapButtonGroup brandChange;
28+
@BindView(R.id.bbutton_group_child_change) BootstrapButtonGroup childChange;
2929

30-
@Bind(R.id.bbutton_group_checked_text) TextView checkedText;
30+
@BindView(R.id.bbutton_group_checked_text) TextView checkedText;
3131

32-
@Bind(R.id.bbutton_group_checked1) BootstrapButton radioButton1;
33-
@Bind(R.id.bbutton_group_checked2) BootstrapButton radioButton2;
34-
@Bind(R.id.bbutton_group_checked3) BootstrapButton radioButton3;
32+
@BindView(R.id.bbutton_group_checked1) BootstrapButton radioButton1;
33+
@BindView(R.id.bbutton_group_checked2) BootstrapButton radioButton2;
34+
@BindView(R.id.bbutton_group_checked3) BootstrapButton radioButton3;
3535

3636
@Override
3737
protected void onCreate(Bundle savedInstanceState) {

sample/src/main/java/com/fractalwrench/androidbootstrap/sample/BootstrapCircleThumbnailExample.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
import com.beardedhen.androidbootstrap.api.defaults.DefaultBootstrapSize;
1111
import com.beardedhen.androidbootstrap.utils.DrawableUtils;
1212

13-
import butterknife.Bind;
13+
import butterknife.BindView;
1414
import butterknife.OnClick;
1515

1616
import static com.beardedhen.androidbootstrap.api.defaults.DefaultBootstrapBrand.DANGER;
@@ -32,13 +32,13 @@ public class BootstrapCircleThumbnailExample extends BaseActivity {
3232
return R.layout.example_bootstrap_circle_thumbnail;
3333
}
3434

35-
@Bind(R.id.bcircle_image_change_example) BootstrapCircleThumbnail imageChange;
36-
@Bind(R.id.bcircle_theme_change_example) BootstrapCircleThumbnail themeChange;
37-
@Bind(R.id.bcircle_border_change_example) BootstrapCircleThumbnail borderChange;
38-
@Bind(R.id.bcircle_size_change_example) BootstrapCircleThumbnail sizeChange;
39-
@Bind(R.id.bcircle_set_image_bitmap_example) BootstrapCircleThumbnail setBitmapExample;
40-
@Bind(R.id.bcircle_set_image_drawable_example) BootstrapCircleThumbnail setDrawableExample;
41-
@Bind(R.id.bcircle_set_image_resource_example) BootstrapCircleThumbnail setResourceExample;
35+
@BindView(R.id.bcircle_image_change_example) BootstrapCircleThumbnail imageChange;
36+
@BindView(R.id.bcircle_theme_change_example) BootstrapCircleThumbnail themeChange;
37+
@BindView(R.id.bcircle_border_change_example) BootstrapCircleThumbnail borderChange;
38+
@BindView(R.id.bcircle_size_change_example) BootstrapCircleThumbnail sizeChange;
39+
@BindView(R.id.bcircle_set_image_bitmap_example) BootstrapCircleThumbnail setBitmapExample;
40+
@BindView(R.id.bcircle_set_image_drawable_example) BootstrapCircleThumbnail setDrawableExample;
41+
@BindView(R.id.bcircle_set_image_resource_example) BootstrapCircleThumbnail setResourceExample;
4242

4343
@Override protected void onCreate(Bundle savedInstanceState) {
4444
super.onCreate(savedInstanceState);

0 commit comments

Comments
 (0)