Skip to content

Commit 1b47b1f

Browse files
Merge pull request Bearded-Hen#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
}

0 commit comments

Comments
 (0)