Skip to content

Commit

Permalink
Merge pull request #186 from fractalwrench/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
jamie-beardedhen authored Dec 10, 2016
2 parents d8c0efc + 561461c commit 0bf4601
Show file tree
Hide file tree
Showing 26 changed files with 228 additions and 162 deletions.
12 changes: 6 additions & 6 deletions AndroidBootstrap/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@ apply plugin: 'com.android.library'
apply from: 'push.gradle'

android {
compileSdkVersion 23
buildToolsVersion "23.0.3"
compileSdkVersion Integer.parseInt(TARGET_SDK_INT)
buildToolsVersion "25.0.1"

defaultConfig {
minSdkVersion 14
targetSdkVersion 23
minSdkVersion Integer.parseInt(MIN_SDK_INT)
targetSdkVersion Integer.parseInt(TARGET_SDK_INT)
versionCode = Integer.parseInt(VERSION_CODE)
versionName = VERSION_NAME
}
}

dependencies {
compile 'com.android.support:support-annotations:23.3.0'
compile 'com.android.support:support-v4:23.3.0'
compile 'com.android.support:support-annotations:25.0.1'
compile 'com.android.support:support-v4:25.0.1'
}
Original file line number Diff line number Diff line change
Expand Up @@ -113,11 +113,13 @@ private void initialise(AttributeSet attrs) {
markdownText = a.getString(R.styleable.AwesomeTextView_bootstrapText);

setClickable(clickable); // allows view to reach android:state_pressed

int gravity = a.getInt(R.styleable.AwesomeTextView_android_gravity, Gravity.CENTER);
setGravity(gravity);
}
finally {
a.recycle();
}
setGravity(Gravity.CENTER);

if (markdownText != null) {
setMarkdownText(markdownText);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package com.beardedhen.androidbootstrap;

import android.content.Context;
import android.content.DialogInterface;
import android.content.res.TypedArray;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
Expand All @@ -10,7 +9,6 @@
import android.support.annotation.Nullable;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewParent;

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

private boolean handleRadioEvent(@NonNull MotionEvent event) {
if (event.getAction() == MotionEvent.ACTION_DOWN) {
if (isSelected()) {
setSelected(false);
}
else { // notify parent to deselect any peers
setSelected(true);
setSelected(true); // notify parent to deselect any peers

ViewParent parent = getParent();
ViewParent parent = getParent();

if (parent instanceof BootstrapButtonGroup) {
((BootstrapButtonGroup) parent).onRadioToggle(parentIndex);
}
if (parent instanceof BootstrapButtonGroup) {
((BootstrapButtonGroup) parent).onRadioToggle(parentIndex);
}
return true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ public class BootstrapDropDown extends AwesomeTextView implements View.OnClickLi
private static final String REPLACE_REGEX_HEADER = "\\{dropdown_header\\}";
private static final String REPLACE_REGEX_SEPARATOR = "\\{dropdown_separator\\}";
private static final String REPLACE_REGEX_DISABLED = "\\{dropdown_disabled\\}";
private static final int SCREEN_WIDTH_GUESS = 1000;

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

expandDirection = ExpandDirection.fromAttributeValue(directionOrdinal);
dropdownData = getContext().getResources().getStringArray(dataOrdinal);

bootstrapSize = DefaultBootstrapSize.fromAttributeValue(sizeOrdinal).scaleFactor();
itemHeight = a.getDimensionPixelSize(R.styleable.BootstrapDropDown_itemHeight, (int) DimenUtils.pixelsFromDpResource(getContext(), R.dimen.bootstrap_dropdown_default_item_height));

if (isInEditMode()) {
dropdownData = new String[] {"Android Studio", "Layout Preview", "Is Always", "Breaking"};
}
else {
dropdownData = getContext().getResources().getStringArray(dataOrdinal);
}
}
finally {
a.recycle();
Expand All @@ -120,9 +128,14 @@ private void initialise(AttributeSet attrs) {
baselineVertPadding = DimenUtils.pixelsFromDpResource(getContext(), R.dimen.bootstrap_button_default_vert_padding);
baselineHoriPadding = DimenUtils.pixelsFromDpResource(getContext(), R.dimen.bootstrap_button_default_hori_padding);

DisplayMetrics metrics = new DisplayMetrics();
((WindowManager) getContext().getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay().getMetrics(metrics);
screenWidth = metrics.widthPixels;
if (isInEditMode()) {
screenWidth = SCREEN_WIDTH_GUESS; // take a sensible guess
}
else {
DisplayMetrics metrics = new DisplayMetrics();
((WindowManager) getContext().getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay().getMetrics(metrics);
screenWidth = metrics.widthPixels;
}

createDropDown();
updateDropDownState();
Expand All @@ -133,8 +146,12 @@ private void createDropDown() {
dropdownWindow = new PopupWindow();
dropdownWindow.setFocusable(true);
dropdownWindow.setHeight(WindowManager.LayoutParams.WRAP_CONTENT);
dropdownWindow.setBackgroundDrawable(DrawableUtils.resolveDrawable(android.R.drawable
.dialog_holo_light_frame, getContext()));

if (!isInEditMode()) {
dropdownWindow.setBackgroundDrawable(DrawableUtils.resolveDrawable(android.R.drawable
.dialog_holo_light_frame, getContext()));
}

dropdownWindow.setContentView(dropdownView);
dropdownWindow.setOnDismissListener(this);
dropdownWindow.setAnimationStyle(android.R.style.Animation_Activity);
Expand All @@ -155,14 +172,16 @@ private ScrollView createDropDownView() {
int clickableChildCounter = 0;

dropdownView.setOrientation(LinearLayout.VERTICAL);
LayoutParams childParams = new LayoutParams(LayoutParams.MATCH_PARENT, DimenUtils.pixelsToDp(itemHeight * bootstrapSize));
int height = (int) (itemHeight * bootstrapSize);
LayoutParams childParams = new LayoutParams(LayoutParams.MATCH_PARENT, height);

for (String text : dropdownData) {
TextView childView = new TextView(getContext());
childView.setGravity(Gravity.CENTER_VERTICAL);
childView.setLayoutParams(childParams);
childView.setPadding(DimenUtils.dpToPixels(baselineItemLeftPadding * bootstrapSize), 0,
DimenUtils.dpToPixels(baselineItemRightPadding * bootstrapSize), 0);

int padding = (int) (baselineItemLeftPadding * bootstrapSize);
childView.setPadding(padding, 0, padding, 0);
childView.setTextSize(baselineDropDownViewFontSize * bootstrapSize);
childView.setTextColor(ColorUtils.resolveColor(android.R.color.black, getContext()));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ private void initialise(AttributeSet attrs) {

try {
int attrValue = a.getInt(R.styleable.BootstrapLabel_bootstrapHeading, 5);
this.roundable = a.getBoolean(R.styleable.BootstrapButton_roundedCorners, false);
this.roundable = a.getBoolean(R.styleable.BootstrapLabel_roundedCorners, false);

this.bootstrapHeading = DefaultBootstrapHeading.fromAttributeValue(attrValue);
}
Expand Down
1 change: 1 addition & 0 deletions AndroidBootstrap/src/main/res/values/attrs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
<attr name="typicon"/>
<attr name="materialIcon" />
<attr name="android:clickable" />
<attr name="android:gravity" />
</declare-styleable>

<declare-styleable name="BootstrapLabel">
Expand Down
2 changes: 1 addition & 1 deletion LICENSE.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) 2013-2015 Bearded Hen
Copyright (c) 2013-2016 Bearded Hen

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ buildscript {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.2'
classpath 'com.android.tools.build:gradle:2.2.3'
}
}

Expand Down
7 changes: 5 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
VERSION_NAME=2.3.0
VERSION_CODE=230
VERSION_NAME=2.3.1
VERSION_CODE=231
GROUP=com.beardedhen

MIN_SDK_INT=14
TARGET_SDK_INT=25

POM_DESCRIPTION=Bootstrap style widgets for Android, with Glyph Icons
POM_URL=https://github.com/Bearded-Hen/Android-Bootstrap
POM_SCM_URL=https://github.com/Bearded-Hen/Android-Bootstrap
Expand Down
16 changes: 9 additions & 7 deletions sample/build.gradle
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
apply plugin: 'com.android.application'

android {
compileSdkVersion 23
buildToolsVersion "23.0.3"
compileSdkVersion Integer.parseInt(TARGET_SDK_INT)
buildToolsVersion "25.0.1"

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

compile 'com.jakewharton:butterknife:7.0.1'
compile 'com.android.support:appcompat-v7:23.4.0'
compile 'com.android.support:support-annotations:23.4.0'
compile 'com.jakewharton:butterknife:8.4.0'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.4.0'

compile 'com.android.support:appcompat-v7:25.0.1'
compile 'com.android.support:support-annotations:25.0.1'
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import com.beardedhen.androidbootstrap.BootstrapText;
import com.beardedhen.androidbootstrap.font.MaterialIcons;

import butterknife.Bind;
import butterknife.BindView;
import butterknife.OnClick;

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

@Bind(R.id.example_fa_text_change) AwesomeTextView exampleChange;
@Bind(R.id.example_fa_text_flash) AwesomeTextView exampleFlash;
@Bind(R.id.example_fa_text_rotate) AwesomeTextView exampleRotate;
@Bind(R.id.example_fa_text_multi_change) AwesomeTextView exampleMultiChange;
@Bind(R.id.example_fa_text_builder) AwesomeTextView exampleBuilder;
@Bind(R.id.example_mix_and_match) AwesomeTextView mixAndMatch;
@BindView(R.id.example_fa_text_change) AwesomeTextView exampleChange;
@BindView(R.id.example_fa_text_flash) AwesomeTextView exampleFlash;
@BindView(R.id.example_fa_text_rotate) AwesomeTextView exampleRotate;
@BindView(R.id.example_fa_text_multi_change) AwesomeTextView exampleMultiChange;
@BindView(R.id.example_fa_text_builder) AwesomeTextView exampleBuilder;
@BindView(R.id.example_mix_and_match) AwesomeTextView mixAndMatch;

private boolean android = true;
private boolean wikipedia = true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@

import com.beardedhen.androidbootstrap.BootstrapAlert;

import butterknife.Bind;
import butterknife.BindView;
import butterknife.OnClick;

public class BootstrapAlertExample extends BaseActivity {

public static final String TAG = "BootstrapAlertExample";

@Bind(R.id.dynamic_alert) BootstrapAlert alert;
@BindView(R.id.dynamic_alert) BootstrapAlert alert;

@Override
protected int getContentLayoutId() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@

import java.util.Random;

import butterknife.Bind;
import butterknife.BindView;
import butterknife.OnClick;

public class BootstrapBadgeExample extends BaseActivity {

@Bind(R.id.xml_badge_button) BootstrapButton xmlBadgeButton;
@Bind(R.id.java_badge_button) BootstrapButton javaBadgeButton;
@Bind(R.id.lonely_badge) BootstrapBadge lonelyBadge;
@BindView(R.id.xml_badge_button) BootstrapButton xmlBadgeButton;
@BindView(R.id.java_badge_button) BootstrapButton javaBadgeButton;
@BindView(R.id.lonely_badge) BootstrapBadge lonelyBadge;

@Override
protected int getContentLayoutId() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import com.beardedhen.androidbootstrap.api.defaults.DefaultBootstrapBrand;
import com.beardedhen.androidbootstrap.api.defaults.DefaultBootstrapSize;

import butterknife.Bind;
import butterknife.BindView;
import butterknife.OnClick;

public class BootstrapButtonExample extends BaseActivity {
Expand All @@ -18,11 +18,11 @@ public class BootstrapButtonExample extends BaseActivity {

private DefaultBootstrapSize size = DefaultBootstrapSize.LG;

@Bind(R.id.bbutton_example_corners) BootstrapButton exampleCorners;
@Bind(R.id.bbutton_example_outline) BootstrapButton exampleOutline;
@Bind(R.id.bbutton_example_size) BootstrapButton exampleSize;
@Bind(R.id.bbutton_example_theme) BootstrapButton exampleTheme;
@Bind(R.id.example_bbutton_custom_style) BootstrapButton exampleCustomStyle;
@BindView(R.id.bbutton_example_corners) BootstrapButton exampleCorners;
@BindView(R.id.bbutton_example_outline) BootstrapButton exampleOutline;
@BindView(R.id.bbutton_example_size) BootstrapButton exampleSize;
@BindView(R.id.bbutton_example_theme) BootstrapButton exampleTheme;
@BindView(R.id.example_bbutton_custom_style) BootstrapButton exampleCustomStyle;

@Override protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import com.beardedhen.androidbootstrap.api.defaults.DefaultBootstrapBrand;
import com.beardedhen.androidbootstrap.api.defaults.DefaultBootstrapSize;

import butterknife.Bind;
import butterknife.BindView;
import butterknife.OnClick;

public class BootstrapButtonGroupExample extends BaseActivity {
Expand All @@ -20,18 +20,18 @@ public class BootstrapButtonGroupExample extends BaseActivity {

private DefaultBootstrapSize size = DefaultBootstrapSize.MD;

@Bind(R.id.bbutton_group_orientation_change) BootstrapButtonGroup orientationChange;
@Bind(R.id.bbutton_group_size_change) BootstrapButtonGroup sizeChange;
@Bind(R.id.bbutton_group_outline_change) BootstrapButtonGroup outlineChange;
@Bind(R.id.bbutton_group_rounded_change) BootstrapButtonGroup roundedChange;
@Bind(R.id.bbutton_group_brand_change) BootstrapButtonGroup brandChange;
@Bind(R.id.bbutton_group_child_change) BootstrapButtonGroup childChange;
@BindView(R.id.bbutton_group_orientation_change) BootstrapButtonGroup orientationChange;
@BindView(R.id.bbutton_group_size_change) BootstrapButtonGroup sizeChange;
@BindView(R.id.bbutton_group_outline_change) BootstrapButtonGroup outlineChange;
@BindView(R.id.bbutton_group_rounded_change) BootstrapButtonGroup roundedChange;
@BindView(R.id.bbutton_group_brand_change) BootstrapButtonGroup brandChange;
@BindView(R.id.bbutton_group_child_change) BootstrapButtonGroup childChange;

@Bind(R.id.bbutton_group_checked_text) TextView checkedText;
@BindView(R.id.bbutton_group_checked_text) TextView checkedText;

@Bind(R.id.bbutton_group_checked1) BootstrapButton radioButton1;
@Bind(R.id.bbutton_group_checked2) BootstrapButton radioButton2;
@Bind(R.id.bbutton_group_checked3) BootstrapButton radioButton3;
@BindView(R.id.bbutton_group_checked1) BootstrapButton radioButton1;
@BindView(R.id.bbutton_group_checked2) BootstrapButton radioButton2;
@BindView(R.id.bbutton_group_checked3) BootstrapButton radioButton3;

@Override
protected void onCreate(Bundle savedInstanceState) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import com.beardedhen.androidbootstrap.api.defaults.DefaultBootstrapSize;
import com.beardedhen.androidbootstrap.utils.DrawableUtils;

import butterknife.Bind;
import butterknife.BindView;
import butterknife.OnClick;

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

@Bind(R.id.bcircle_image_change_example) BootstrapCircleThumbnail imageChange;
@Bind(R.id.bcircle_theme_change_example) BootstrapCircleThumbnail themeChange;
@Bind(R.id.bcircle_border_change_example) BootstrapCircleThumbnail borderChange;
@Bind(R.id.bcircle_size_change_example) BootstrapCircleThumbnail sizeChange;
@Bind(R.id.bcircle_set_image_bitmap_example) BootstrapCircleThumbnail setBitmapExample;
@Bind(R.id.bcircle_set_image_drawable_example) BootstrapCircleThumbnail setDrawableExample;
@Bind(R.id.bcircle_set_image_resource_example) BootstrapCircleThumbnail setResourceExample;
@BindView(R.id.bcircle_image_change_example) BootstrapCircleThumbnail imageChange;
@BindView(R.id.bcircle_theme_change_example) BootstrapCircleThumbnail themeChange;
@BindView(R.id.bcircle_border_change_example) BootstrapCircleThumbnail borderChange;
@BindView(R.id.bcircle_size_change_example) BootstrapCircleThumbnail sizeChange;
@BindView(R.id.bcircle_set_image_bitmap_example) BootstrapCircleThumbnail setBitmapExample;
@BindView(R.id.bcircle_set_image_drawable_example) BootstrapCircleThumbnail setDrawableExample;
@BindView(R.id.bcircle_set_image_resource_example) BootstrapCircleThumbnail setResourceExample;

@Override protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Expand Down
Loading

0 comments on commit 0bf4601

Please sign in to comment.