Skip to content

Commit f021762

Browse files
committed
update dependencies to latest versions
1 parent 3c6331e commit f021762

11 files changed

Lines changed: 153 additions & 91 deletions

File tree

AndroidBootstrap/build.gradle

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,17 @@ apply from: 'push.gradle'
33

44
android {
55
compileSdkVersion 23
6-
buildToolsVersion "23.0.2"
6+
buildToolsVersion "23.0.3"
77

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

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

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

Lines changed: 59 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@
2323

2424
import java.util.concurrent.atomic.AtomicInteger;
2525

26+
/**
27+
* See <a href="http://getbootstrap.com/components/#badges>http://getbootstrap.com/components/#alerts</a>
28+
*/
2629
public class BootstrapAlert extends RelativeLayout {
2730

2831
private ImageView closeButton;
@@ -78,12 +81,15 @@ private void initialise(AttributeSet attrs) {
7881
if (messageText == null) {
7982
messageText = "";
8083
}
81-
} finally {
84+
}
85+
finally {
8286
a.recycle();
8387
}
8488

85-
baselineFontSize = DimenUtils.pixelsFromSpResource(getContext(), R.dimen.bootstrap_button_default_font_size);
86-
baselinePadding = DimenUtils.pixelsFromDpResource(getContext(), R.dimen.bootstrap_alert_paddings);
89+
baselineFontSize = DimenUtils.pixelsFromSpResource(getContext(),
90+
R.dimen.bootstrap_button_default_font_size);
91+
baselinePadding = DimenUtils.pixelsFromDpResource(getContext(),
92+
R.dimen.bootstrap_alert_paddings);
8793

8894
updateBootstrapState();
8995
}
@@ -94,7 +100,8 @@ private void updateBootstrapState() {
94100
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN_MR1) {
95101
alertText.setId(generateViewUniqueId());
96102
closeButton.setId(generateViewUniqueId());
97-
} else {
103+
}
104+
else {
98105
alertText.setId(View.generateViewId());
99106
closeButton.setId(View.generateViewId());
100107
}
@@ -106,48 +113,60 @@ private void updateBootstrapState() {
106113
fadeOutAnimation.setInterpolator(new AccelerateInterpolator());
107114

108115
fadeInAnimation.setAnimationListener(new Animation.AnimationListener() {
109-
@Override public void onAnimationStart(Animation animation) {setVisibility(VISIBLE);}
110-
@Override public void onAnimationEnd(Animation animation) {}
111-
@Override public void onAnimationRepeat(Animation animation) {}
116+
@Override
117+
public void onAnimationStart(Animation animation) {setVisibility(VISIBLE);}
118+
119+
@Override
120+
public void onAnimationEnd(Animation animation) {}
121+
122+
@Override
123+
public void onAnimationRepeat(Animation animation) {}
112124
});
113125

114126
fadeOutAnimation.setAnimationListener(new Animation.AnimationListener() {
115-
@Override public void onAnimationStart(Animation animation) {}
116-
@Override public void onAnimationEnd(Animation animation) {
127+
@Override
128+
public void onAnimationStart(Animation animation) {}
129+
130+
@Override
131+
public void onAnimationEnd(Animation animation) {
117132
setVisibility(GONE);
118-
if (onDismissListener != null) onDismissListener.onDismiss();
133+
if (onDismissListener != null) { onDismissListener.onDismiss(); }
119134
}
120-
@Override public void onAnimationRepeat(Animation animation) {}
135+
136+
@Override
137+
public void onAnimationRepeat(Animation animation) {}
121138
});
122139

123-
LayoutParams textParams = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
124-
LayoutParams closeParams = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
140+
LayoutParams textParams = new LayoutParams(LayoutParams.MATCH_PARENT,
141+
LayoutParams.WRAP_CONTENT);
142+
LayoutParams closeParams = new LayoutParams(LayoutParams.WRAP_CONTENT,
143+
LayoutParams.WRAP_CONTENT);
125144
textParams.addRule(RelativeLayout.LEFT_OF, closeButton.getId());
126145
closeParams.addRule(RelativeLayout.ALIGN_PARENT_RIGHT, RelativeLayout.TRUE);
127146

128147
alertText.setLayoutParams(textParams);
129148
alertText.setTextSize(baselineFontSize);
130149
alertText.setGravity(Gravity.LEFT);
131-
alertText.setTextColor(BootstrapDrawableFactory.bootstrapButtonText(
132-
getContext(),
133-
true,
134-
bootstrapBrand));
135-
alertText.setText(Html.fromHtml(String.format("<b>%s</b>%s", strongText, (strongText.length() > 0 ? "&nbsp;" + messageText : messageText))));
150+
alertText.setTextColor(
151+
BootstrapDrawableFactory.bootstrapButtonText(getContext(), true, bootstrapBrand));
152+
alertText.setText(Html.fromHtml(String.format("<b>%s</b>%s", strongText,
153+
(strongText.length() > 0 ?
154+
"&nbsp;" + messageText :
155+
messageText))));
136156

137157
closeButton.setLayoutParams(closeParams);
138-
closeButton.setBackgroundDrawable(BootstrapDrawableFactory.bootstrapAlertCloseIcon(
139-
getContext(),
140-
(int) baselineFontSize,
141-
(int) baselineFontSize,
142-
DimenUtils.dpToPixels(6)));
158+
closeButton.setBackgroundDrawable(
159+
BootstrapDrawableFactory.bootstrapAlertCloseIcon(getContext(),
160+
(int) baselineFontSize,
161+
(int) baselineFontSize,
162+
DimenUtils.dpToPixels(6)));
143163

144-
Drawable bg = BootstrapDrawableFactory.bootstrapAlert(
145-
getContext(),
146-
bootstrapBrand);
164+
Drawable bg = BootstrapDrawableFactory.bootstrapAlert(getContext(), bootstrapBrand);
147165

148166
if (Build.VERSION.SDK_INT >= 16) {
149167
setBackground(bg);
150-
} else {
168+
}
169+
else {
151170
setBackgroundDrawable(bg);
152171
}
153172
addView(alertText);
@@ -158,23 +177,22 @@ private void updateBootstrapState() {
158177
public void run() {
159178
Rect bounds = new Rect();
160179
closeButton.getHitRect(bounds);
161-
bounds.top -= DimenUtils.dpToPixels(6);
180+
bounds.top -= DimenUtils.dpToPixels(6);
162181
bounds.bottom += DimenUtils.dpToPixels(6);
163-
bounds.left -= DimenUtils.dpToPixels(6);
164-
bounds.right += DimenUtils.dpToPixels(6);
182+
bounds.left -= DimenUtils.dpToPixels(6);
183+
bounds.right += DimenUtils.dpToPixels(6);
165184
TouchDelegate touchDelegate = new TouchDelegate(bounds, closeButton);
166185
if (View.class.isInstance(closeButton.getParent())) {
167186
((View) closeButton.getParent()).setTouchDelegate(touchDelegate);
168187
}
169188
}
170189
});
171-
closeButton.setOnClickListener(
172-
new OnClickListener() {
173-
@Override public void onClick(View v) {
174-
hide();
175-
}
176-
}
177-
);
190+
closeButton.setOnClickListener(new OnClickListener() {
191+
@Override
192+
public void onClick(View v) {
193+
hide();
194+
}
195+
});
178196
}
179197

180198
int vert = (int) (baselinePadding * 1.5);
@@ -201,11 +219,13 @@ public void setOnDismissListener(OnDismissListener onDismissListener) {
201219
}
202220

203221
private int generateViewUniqueId() {
204-
for (;;) {
222+
for (; ; ) {
205223
final int result = nextGeneratedId.get();
206224
// aapt-generated IDs have the high byte nonzero; clamp to the range under that.
207225
int newValue = result + 1;
208-
if (newValue > 0x00FFFFFF) newValue = 1; // Roll over to 1, not 0.
226+
if (newValue > 0x00FFFFFF) {
227+
newValue = 1; // Roll over to 1, not 0.
228+
}
209229
if (nextGeneratedId.compareAndSet(result, newValue)) {
210230
return result;
211231
}

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

Lines changed: 56 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,21 @@
44
import android.content.res.TypedArray;
55
import android.graphics.drawable.Drawable;
66
import android.os.Build;
7+
import android.support.annotation.NonNull;
78
import android.util.AttributeSet;
89
import android.widget.ImageView;
910

1011
import com.beardedhen.androidbootstrap.api.attributes.BootstrapBrand;
1112
import com.beardedhen.androidbootstrap.api.defaults.DefaultBootstrapBrand;
1213
import com.beardedhen.androidbootstrap.api.defaults.DefaultBootstrapSize;
14+
import com.beardedhen.androidbootstrap.api.view.BootstrapBrandView;
1315
import com.beardedhen.androidbootstrap.api.view.BootstrapSizeView;
1416
import com.beardedhen.androidbootstrap.utils.DimenUtils;
1517

16-
public class BootstrapBadge extends ImageView implements BootstrapSizeView {
18+
/**
19+
* See <a href="http://getbootstrap.com/components/#badges>http://getbootstrap.com/components/#badges</a>
20+
*/
21+
public class BootstrapBadge extends ImageView implements BootstrapSizeView, BootstrapBrandView {
1722

1823
private int badgeCount;
1924
private int size;
@@ -45,50 +50,40 @@ private void init(AttributeSet attrs) {
4550
int sizeOrdinal = a.getInt(R.styleable.BootstrapBadge_bootstrapSize, -1);
4651

4752
allowZeroValue = a.getBoolean(R.styleable.BootstrapBadge_allowZeroValue, false);
48-
bootstrapSize = DefaultBootstrapSize.fromAttributeValue(sizeOrdinal).scaleFactor();
49-
} finally {
53+
bootstrapSize = DefaultBootstrapSize.fromAttributeValue(sizeOrdinal)
54+
.scaleFactor();
55+
}
56+
finally {
5057
a.recycle();
5158
}
5259

53-
size = (int) DimenUtils.pixelsFromDpResource(getContext(), R.dimen.bootstrap_badge_default_size);
60+
size = (int) DimenUtils.pixelsFromDpResource(getContext(),
61+
R.dimen.bootstrap_badge_default_size);
5462
updateBootstrapState();
5563
}
5664

5765
private void updateBootstrapState() {
58-
badgeDrawable = BootstrapDrawableFactory.createBadgeDrawable(getContext(),
59-
bootstrapBrand,
60-
(int) (size * bootstrapSize),
61-
(int) (size * bootstrapSize),
62-
badgeCount,
63-
allowZeroValue,
64-
insideContainer);
66+
badgeDrawable = BootstrapDrawableFactory.createBadgeDrawable(getContext(), bootstrapBrand,
67+
(int) (size * bootstrapSize),
68+
(int) (size * bootstrapSize),
69+
badgeCount, allowZeroValue,
70+
insideContainer);
6571

6672
if (Build.VERSION.SDK_INT >= 16) {
6773
setBackground(badgeDrawable);
68-
} else {
74+
}
75+
else {
6976
setBackgroundDrawable(badgeDrawable);
7077
}
7178
}
7279

73-
public void setBootstrapBrand(BootstrapBrand bootstrapBrand, boolean insideContainer) {
74-
this.bootstrapBrand = bootstrapBrand;
75-
this.insideContainer = insideContainer;
76-
updateBootstrapState();
77-
}
78-
7980
public void setBadgeCount(int badgeCount) {
8081
this.badgeCount = badgeCount;
8182
updateBootstrapState();
8283
}
8384

84-
@Override public void setBootstrapSize(DefaultBootstrapSize bootstrapSize) {
85-
this.bootstrapSize = bootstrapSize.scaleFactor();
86-
updateBootstrapState();
87-
}
88-
89-
@Override public void setBootstrapSize(float bootstrapSize) {
90-
this.bootstrapSize = bootstrapSize;
91-
updateBootstrapState();
85+
public boolean isAllowZeroValue() {
86+
return allowZeroValue;
9287
}
9388

9489
public void setAllowZeroValue(boolean allowZeroValue) {
@@ -104,11 +99,42 @@ public Drawable getBadgeDrawable() {
10499
return badgeDrawable;
105100
}
106101

107-
@Override public float getBootstrapSize() {
108-
return bootstrapSize;
102+
103+
104+
105+
106+
107+
public void setBootstrapBrand(BootstrapBrand bootstrapBrand, boolean insideContainer) {
108+
this.insideContainer = insideContainer;
109+
setBootstrapBrand(bootstrapBrand);
109110
}
110111

111-
public boolean isAllowZeroValue() {
112-
return allowZeroValue;
112+
@Override
113+
public void setBootstrapBrand(@NonNull BootstrapBrand bootstrapBrand) {
114+
this.bootstrapBrand = bootstrapBrand;
115+
updateBootstrapState();
116+
}
117+
118+
@NonNull
119+
@Override
120+
public BootstrapBrand getBootstrapBrand() {
121+
return bootstrapBrand;
122+
}
123+
124+
@Override
125+
public void setBootstrapSize(DefaultBootstrapSize bootstrapSize) {
126+
this.bootstrapSize = bootstrapSize.scaleFactor();
127+
updateBootstrapState();
128+
}
129+
130+
@Override
131+
public void setBootstrapSize(float bootstrapSize) {
132+
this.bootstrapSize = bootstrapSize;
133+
updateBootstrapState();
134+
}
135+
136+
@Override
137+
public float getBootstrapSize() {
138+
return bootstrapSize;
113139
}
114140
}

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

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,11 @@ private void initialise(AttributeSet attrs) {
104104
bundle.putInt(KEY_INDEX, parentIndex);
105105
bundle.putFloat(BootstrapSizeView.KEY, bootstrapSize);
106106
bundle.putSerializable(KEY_MODE, buttonMode);
107-
if (bootstrapBadge != null) bundle.putInt(BadgeContainerView.KEY, bootstrapBadge.getBadgeCount());
107+
108+
if (bootstrapBadge != null) {
109+
bundle.putInt(BadgeContainerView.KEY, bootstrapBadge
110+
.getBadgeCount());
111+
}
108112
return bundle;
109113
}
110114

@@ -303,8 +307,7 @@ public void setChecked(boolean checked) {
303307
}
304308

305309
@Override public int getBadgeCount() {
306-
if (bootstrapBadge != null) return bootstrapBadge.getBadgeCount();
307-
else return 0;
310+
return bootstrapBadge != null ? bootstrapBadge.getBadgeCount() : 0;
308311
}
309312
@Override public float getBootstrapSize() {
310313
return bootstrapSize;

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

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -447,7 +447,8 @@ public static Drawable createBadgeDrawable(Context context, BootstrapBrand brand
447447
if (insideAnObject) {
448448
badgePaint.setColor(brand.defaultTextColor(context));
449449
badgeTextPaint.setColor(brand.defaultFill(context));
450-
} else {
450+
}
451+
else {
451452
badgePaint.setColor(brand.defaultFill(context));
452453
badgeTextPaint.setColor(brand.defaultTextColor(context));
453454
}
@@ -475,7 +476,10 @@ public static Drawable createBadgeDrawable(Context context, BootstrapBrand brand
475476
canvas.drawText(String.valueOf(badgeCount), canvasBounds.width() / 2, canvasBounds.height() / 2 - ((badgeTextPaint.descent() + badgeTextPaint.ascent()) / 2), badgeTextPaint);
476477

477478
return new BitmapDrawable(context.getResources(), canvasBitmap);
478-
} else return null;
479+
}
480+
else {
481+
return null;
482+
}
479483
}
480484

481485
static ColorStateList bootstrapDropDownViewText(Context context) {

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -382,11 +382,11 @@ public void setDropdownData(String[] dropdownData) {
382382
int gravity;
383383
int axisXOffset;
384384
if (dropDownViewWidth + getX() > screenWidth) {
385-
gravity = Gravity.TOP | Gravity.RIGHT;
385+
gravity = Gravity.TOP | Gravity.END;
386386
axisXOffset = DimenUtils.dpToPixels(8);
387387
}
388388
else {
389-
gravity = Gravity.TOP | Gravity.LEFT;
389+
gravity = Gravity.TOP | Gravity.START;
390390
axisXOffset = -DimenUtils.dpToPixels(8);
391391
}
392392
int axisYOffset = DimenUtils.dpToPixels(4);

0 commit comments

Comments
 (0)