Showing preview only (867K chars total). Download the full file or copy to clipboard to get everything.
Repository: Bearded-Hen/Android-Bootstrap
Branch: master
Commit: b3d62cc1847e
Files: 111
Total size: 821.0 KB
Directory structure:
gitextract_i4nmgdax/
├── .gitignore
├── ADD_FONT.md
├── AndroidBootstrap/
│ ├── build.gradle
│ ├── proguard-project.txt
│ ├── push.gradle
│ └── src/
│ └── main/
│ ├── AndroidManifest.xml
│ ├── java/
│ │ └── com/
│ │ └── beardedhen/
│ │ └── androidbootstrap/
│ │ ├── AwesomeTextView.java
│ │ ├── BetaApi.java
│ │ ├── BootstrapAlert.java
│ │ ├── BootstrapBadge.java
│ │ ├── BootstrapBaseThumbnail.java
│ │ ├── BootstrapButton.java
│ │ ├── BootstrapButtonGroup.java
│ │ ├── BootstrapCircleThumbnail.java
│ │ ├── BootstrapDrawableFactory.java
│ │ ├── BootstrapDropDown.java
│ │ ├── BootstrapEditText.java
│ │ ├── BootstrapGroup.java
│ │ ├── BootstrapLabel.java
│ │ ├── BootstrapProgressBar.java
│ │ ├── BootstrapProgressBarGroup.java
│ │ ├── BootstrapText.java
│ │ ├── BootstrapThumbnail.java
│ │ ├── BootstrapWell.java
│ │ ├── IconResolver.java
│ │ ├── TypefaceProvider.java
│ │ ├── api/
│ │ │ ├── attributes/
│ │ │ │ ├── BootstrapBrand.java
│ │ │ │ ├── BootstrapHeading.java
│ │ │ │ └── ViewGroupPosition.java
│ │ │ ├── defaults/
│ │ │ │ ├── ButtonMode.java
│ │ │ │ ├── DefaultBootstrapBrand.java
│ │ │ │ ├── DefaultBootstrapHeading.java
│ │ │ │ ├── DefaultBootstrapSize.java
│ │ │ │ └── ExpandDirection.java
│ │ │ └── view/
│ │ │ ├── BadgeContainerView.java
│ │ │ ├── BootstrapBadgeView.java
│ │ │ ├── BootstrapBrandView.java
│ │ │ ├── BootstrapHeadingView.java
│ │ │ ├── BootstrapSizeView.java
│ │ │ ├── BootstrapTextView.java
│ │ │ ├── BorderView.java
│ │ │ ├── ButtonModeView.java
│ │ │ ├── OutlineableView.java
│ │ │ ├── ProgressView.java
│ │ │ └── RoundableView.java
│ │ ├── font/
│ │ │ ├── AwesomeTypefaceSpan.java
│ │ │ ├── FontAwesome.java
│ │ │ ├── IconSet.java
│ │ │ ├── MaterialIcons.java
│ │ │ └── Typicon.java
│ │ └── utils/
│ │ ├── ColorUtils.java
│ │ ├── DimenUtils.java
│ │ ├── DrawableUtils.java
│ │ └── ViewUtils.java
│ └── res/
│ └── values/
│ ├── attrs.xml
│ ├── attrs_font_awesome.xml
│ ├── attrs_materialIcon.xml
│ ├── attrs_typicons.xml
│ ├── colors.xml
│ └── dimens.xml
├── LICENSE.txt
├── README.md
├── TODO.md
├── build.gradle
├── circle.yml
├── gradle/
│ └── wrapper/
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── gradle.properties
├── gradlew
├── gradlew.bat
├── sample/
│ ├── .gitignore
│ ├── build.gradle
│ ├── proguard-rules.pro
│ └── src/
│ └── main/
│ ├── AndroidManifest.xml
│ ├── java/
│ │ └── com/
│ │ └── fractalwrench/
│ │ └── androidbootstrap/
│ │ └── sample/
│ │ ├── AwesomeTextViewExample.java
│ │ ├── BaseActivity.java
│ │ ├── BootstrapAlertExample.java
│ │ ├── BootstrapBadgeExample.java
│ │ ├── BootstrapButtonExample.java
│ │ ├── BootstrapButtonGroupExample.java
│ │ ├── BootstrapCircleThumbnailExample.java
│ │ ├── BootstrapDropDownExample.java
│ │ ├── BootstrapEditTextExample.java
│ │ ├── BootstrapLabelExample.java
│ │ ├── BootstrapProgressBarExample.java
│ │ ├── BootstrapProgressBarGroupExample.java
│ │ ├── BootstrapThumbnailExample.java
│ │ ├── BootstrapWellExample.java
│ │ ├── CustomBootstrapStyle.java
│ │ ├── HomeActivity.java
│ │ └── SampleApplication.java
│ └── res/
│ ├── layout/
│ │ ├── activity_base.xml
│ │ ├── activity_main.xml
│ │ ├── example_awesome_text_view.xml
│ │ ├── example_bootstrap_alert.xml
│ │ ├── example_bootstrap_badge.xml
│ │ ├── example_bootstrap_button.xml
│ │ ├── example_bootstrap_button_group.xml
│ │ ├── example_bootstrap_circle_thumbnail.xml
│ │ ├── example_bootstrap_dropdown.xml
│ │ ├── example_bootstrap_edit_text_view.xml
│ │ ├── example_bootstrap_label.xml
│ │ ├── example_bootstrap_progress_bar.xml
│ │ ├── example_bootstrap_progress_bar_group.xml
│ │ ├── example_bootstrap_thumbnail.xml
│ │ └── example_bootstrap_well.xml
│ └── values/
│ ├── colors.xml
│ ├── dimens.xml
│ ├── strings.xml
│ └── styles.xml
└── settings.gradle
================================================
FILE CONTENTS
================================================
================================================
FILE: .gitignore
================================================
# generated files
bin/
gen/
# Local configuration file (sdk path, etc)
local.properties
# IntelliJ files
.idea
*.iml
# gradle directory
.gradle
build/
# thumbnails
.DS_STORE
classes/
================================================
FILE: ADD_FONT.md
================================================
Adding a Custom Font
=================
Android Bootstrap uses Typeface Icon Sets, which provide scalable graphics without the hassle of
adding different drawable sizes for various screen densities. It should be possible to define your
own icon sets by following the instructions below. Please send pull requests if you want an icon set
added to the library by default.
1.
Find the [reference sheet](https://fortawesome.github.io/Font-Awesome/cheatsheet/)
for the typeface, and use a script to parse it.
An example [parsing script](https://github.com/Bearded-Hen/AndroidBootstrapSample) is currently available
for the FontAwesome and Typicon typefaces. If possible, please also send a pull request for the script itself!
2.
Create a class which implements the IconSet interface. This describes the location of the typeface
in the assets directory, and the icon codes which map to unicode characters. See the default icon sets
for examples.
3.
Copy the typeface TTF file to the assets directory.
4.
Initialise the custom typeface by calling TypefaceProvider.registerCustomIconSet().
5.
Add icons to text using the BootstrapTextBuilder.
6.
Test out the new icon set, send a pull request, or raise an issue if something isn't working.
================================================
FILE: AndroidBootstrap/build.gradle
================================================
apply plugin: 'com.android.library'
apply from: 'push.gradle'
android {
compileSdkVersion Integer.parseInt(TARGET_SDK_INT)
buildToolsVersion "25.0.3"
defaultConfig {
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:25.3.1'
compile 'com.android.support:support-v4:25.3.1'
}
================================================
FILE: AndroidBootstrap/proguard-project.txt
================================================
# To enable ProGuard in your project, edit project.properties
# to define the proguard.config property as described in that file.
#
# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in ${sdk.dir}/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the ProGuard
# include property in project.properties.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# Add any project specific keep options here:
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
================================================
FILE: AndroidBootstrap/push.gradle
================================================
/*
* Copyright 2013 Chris Banes
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
apply plugin: 'maven'
apply plugin: 'signing'
def isReleaseBuild() {
return VERSION_NAME.contains("SNAPSHOT") == false
}
def getReleaseRepositoryUrl() {
return hasProperty('RELEASE_REPOSITORY_URL') ? RELEASE_REPOSITORY_URL
: "https://oss.sonatype.org/service/local/staging/deploy/maven2/"
}
def getSnapshotRepositoryUrl() {
return hasProperty('SNAPSHOT_REPOSITORY_URL') ? SNAPSHOT_REPOSITORY_URL
: "https://oss.sonatype.org/content/repositories/snapshots/"
}
def getRepositoryUsername() {
return hasProperty('NEXUS_USERNAME') ? NEXUS_USERNAME : ""
}
def getRepositoryPassword() {
return hasProperty('NEXUS_PASSWORD') ? NEXUS_PASSWORD : ""
}
afterEvaluate { project ->
uploadArchives {
repositories {
mavenDeployer {
beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
pom.groupId = GROUP
pom.artifactId = POM_ARTIFACT_ID
pom.version = VERSION_NAME
repository(url: getReleaseRepositoryUrl()) {
authentication(userName: getRepositoryUsername(), password: getRepositoryPassword())
}
snapshotRepository(url: getSnapshotRepositoryUrl()) {
authentication(userName: getRepositoryUsername(), password: getRepositoryPassword())
}
pom.project {
name POM_NAME
packaging POM_PACKAGING
description POM_DESCRIPTION
url POM_URL
scm {
url POM_SCM_URL
connection POM_SCM_CONNECTION
developerConnection POM_SCM_DEV_CONNECTION
}
licenses {
license {
name POM_LICENCE_NAME
url POM_LICENCE_URL
distribution POM_LICENCE_DIST
}
}
developers {
developer {
id POM_DEVELOPER_ID
name POM_DEVELOPER_NAME
}
}
}
}
}
}
signing {
required { isReleaseBuild() && gradle.taskGraph.hasTask("uploadArchives") }
sign configurations.archives
}
task androidJavadocs(type: Javadoc) {
source = android.sourceSets.main.java.srcDirs
classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
}
task androidJavadocsJar(type: Jar, dependsOn: androidJavadocs) {
classifier = 'javadoc'
from androidJavadocs.destinationDir
}
task androidSourcesJar(type: Jar) {
classifier = 'sources'
from android.sourceSets.main.java.sourceFiles
}
artifacts {
archives androidSourcesJar
archives androidJavadocsJar
}
}
================================================
FILE: AndroidBootstrap/src/main/AndroidManifest.xml
================================================
<?xml version="1.0" encoding="utf-8"?>
<manifest package="com.beardedhen.androidbootstrap" />
================================================
FILE: AndroidBootstrap/src/main/java/com/beardedhen/androidbootstrap/AwesomeTextView.java
================================================
package com.beardedhen.androidbootstrap;
import android.content.Context;
import android.content.res.TypedArray;
import android.os.Bundle;
import android.os.Parcelable;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.util.AttributeSet;
import android.view.Gravity;
import android.view.animation.AlphaAnimation;
import android.view.animation.Animation;
import android.view.animation.LinearInterpolator;
import android.view.animation.RotateAnimation;
import android.widget.TextView;
import com.beardedhen.androidbootstrap.api.attributes.BootstrapBrand;
import com.beardedhen.androidbootstrap.api.defaults.DefaultBootstrapBrand;
import com.beardedhen.androidbootstrap.api.view.BootstrapBrandView;
import com.beardedhen.androidbootstrap.api.view.BootstrapTextView;
import com.beardedhen.androidbootstrap.font.FontAwesome;
import com.beardedhen.androidbootstrap.font.IconSet;
import com.beardedhen.androidbootstrap.font.MaterialIcons;
import com.beardedhen.androidbootstrap.font.Typicon;
import java.io.Serializable;
/**
* This class extends the default Android TextView to supply Bootstrap behaviour. The text color
* can be set by changing the BootstrapBrand, and scalable Typeface icons can be interspersed with
* regular text, using the BootstrapText spannable.
*/
public class AwesomeTextView extends TextView implements BootstrapTextView, BootstrapBrandView {
private static final String TAG = "com.beardedhen.androidbootstrap.AwesomeTextView";
private BootstrapText bootstrapText;
private BootstrapBrand bootstrapBrand;
public enum AnimationSpeed {
FAST(500, 200),
MEDIUM(1000, 500),
SLOW(2000, 1000);
private final long rotateDuration;
private final long flashDuration;
AnimationSpeed(long rotateDuration, long flashDuration) {
this.rotateDuration = rotateDuration;
this.flashDuration = flashDuration;
}
public long getRotateDuration() {
return rotateDuration;
}
public long getFlashDuration() {
return flashDuration;
}
}
public AwesomeTextView(Context context) {
super(context);
initialise(null);
}
public AwesomeTextView(Context context, AttributeSet attrs) {
super(context, attrs);
initialise(attrs);
}
public AwesomeTextView(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
initialise(attrs);
}
private void initialise(AttributeSet attrs) {
TypedArray a = getContext().obtainStyledAttributes(attrs, R.styleable.AwesomeTextView);
String markdownText;
try {
int typeOrdinal = a.getInt(R.styleable.AwesomeTextView_bootstrapBrand, -1);
int faIconOrdinal = a.getInt(R.styleable.AwesomeTextView_fontAwesomeIcon, -1);
int typiconOrdinal = a.getInt(R.styleable.AwesomeTextView_typicon, -1);
int materialIconOrdinal = a.getInt(R.styleable.AwesomeTextView_materialIcon, -1);
boolean clickable = a.getBoolean(R.styleable.AwesomeTextView_android_clickable, true);
this.bootstrapBrand = DefaultBootstrapBrand.fromAttributeValue(typeOrdinal);
boolean editMode = isInEditMode();
if (typiconOrdinal != -1) {
final IconSet typicon = TypefaceProvider.retrieveRegisteredIconSet(Typicon.FONT_PATH, editMode);
if (!editMode) {
setIcon(typicon.iconCodeForAttrIndex(typiconOrdinal), typicon);
}
}
if (faIconOrdinal != -1) {
final IconSet fontAwesome = TypefaceProvider.retrieveRegisteredIconSet(FontAwesome.FONT_PATH, editMode);
if (!editMode) {
setIcon(fontAwesome.iconCodeForAttrIndex(faIconOrdinal), fontAwesome);
}
}
if (materialIconOrdinal != -1) {
final IconSet materialIcons = TypefaceProvider.retrieveRegisteredIconSet(MaterialIcons.FONT_PATH, editMode);
if (!editMode) {
setIcon(materialIcons.iconCodeForAttrIndex(materialIconOrdinal), materialIcons);
}
}
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();
}
if (markdownText != null) {
setMarkdownText(markdownText);
}
updateBootstrapState();
}
@Override public Parcelable onSaveInstanceState() {
Bundle bundle = new Bundle();
bundle.putParcelable(TAG, super.onSaveInstanceState());
bundle.putSerializable(BootstrapTextView.KEY, bootstrapText);
bundle.putSerializable(BootstrapBrand.KEY, bootstrapBrand);
return bundle;
}
@Override public void onRestoreInstanceState(Parcelable state) {
if (state instanceof Bundle) {
Bundle bundle = (Bundle) state;
Serializable text = bundle.getSerializable(BootstrapTextView.KEY);
Serializable brand = bundle.getSerializable(BootstrapBrand.KEY);
if (brand instanceof BootstrapBrand) {
bootstrapBrand = (BootstrapBrand) brand;
}
if (text instanceof BootstrapText) {
bootstrapText = (BootstrapText) text;
}
state = bundle.getParcelable(TAG);
}
super.onRestoreInstanceState(state);
updateBootstrapState();
}
/**
* Starts a Flashing Animation on the AwesomeTextView
*
* @param forever whether the animation should be infinite or play once
* @param speed how fast the item should flash
*/
public void startFlashing(boolean forever, AnimationSpeed speed) {
Animation fadeIn = new AlphaAnimation(0, 1);
//set up extra variables
fadeIn.setDuration(50);
fadeIn.setRepeatMode(Animation.REVERSE);
//default repeat count is 0, however if user wants, set it up to be infinite
fadeIn.setRepeatCount(0);
if (forever) {
fadeIn.setRepeatCount(Animation.INFINITE);
}
fadeIn.setStartOffset(speed.getFlashDuration());
startAnimation(fadeIn);
}
/**
* Starts a rotating animation on the AwesomeTextView
*
* @param clockwise true for clockwise, false for anti clockwise spinning
* @param speed how fast the item should rotate
*/
public void startRotate(boolean clockwise, AnimationSpeed speed) {
Animation rotate;
//set up the rotation animation
if (clockwise) {
rotate = new RotateAnimation(0, 360, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
}
else {
rotate = new RotateAnimation(360, 0, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
}
//set up some extra variables
rotate.setRepeatCount(Animation.INFINITE);
rotate.setInterpolator(new LinearInterpolator());
rotate.setStartOffset(0);
rotate.setRepeatMode(Animation.RESTART);
rotate.setDuration(speed.getRotateDuration());
startAnimation(rotate);
}
/**
* Sets the text to display a FontIcon, replacing whatever text is already present.
* Used to set the text to display a FontAwesome Icon.
*
* @param iconSet - An implementation of FontIcon
*/
public void setIcon(CharSequence iconCode, IconSet iconSet) {
setBootstrapText(new BootstrapText.Builder(getContext(), isInEditMode()).addIcon(iconCode, iconSet).build());
}
/**
* Sets the text to display a FontIcon, replacing whatever text is already present.
* Used to set the text to display a FontAwesome Icon.
*
* @param iconCode the fontawesome icon code e.g. "fa_play"
*/
public void setFontAwesomeIcon(@FontAwesome.Icon CharSequence iconCode) {
setBootstrapText(new BootstrapText.Builder(getContext(), isInEditMode()).addFontAwesomeIcon(iconCode).build());
}
/**
* Sets the text to display a MaterialIcon, replacing whatever text is already present.
* Used to set the text to display a MaterialIcon Icon.
*
* @param iconCode the fontawesome icon code e.g. "md_share"
*/
public void setMaterialIcon(@FontAwesome.Icon CharSequence iconCode) {
setBootstrapText(new BootstrapText.Builder(getContext(), isInEditMode()).addMaterialIcon(iconCode).build());
}
/**
* Sets the text to display a FontIcon, replacing whatever text is already present.
* Used to set the text to display a Typicon.
*
* @param iconCode the typicon icon code e.g. "ty_adjust_brightness"
*/
public void setTypicon(@Typicon.Icon CharSequence iconCode) {
setBootstrapText(new BootstrapText.Builder(getContext(), isInEditMode()).addTypicon(iconCode).build());
}
@Override public void setMarkdownText(String text) {
setBootstrapText(IconResolver.resolveMarkdown(getContext(), text, isInEditMode()));
}
protected void updateBootstrapState() {
if (bootstrapText != null) {
setText(bootstrapText);
}
if (bootstrapBrand != null) {
setTextColor(bootstrapBrand.defaultFill(getContext()));
}
}
/*
* Getters/Setters
*/
@Override public void setBootstrapText(BootstrapText bootstrapText) {
this.bootstrapText = bootstrapText;
updateBootstrapState();
}
@Nullable @Override public BootstrapText getBootstrapText() {
return bootstrapText;
}
@Override public void setBootstrapBrand(@NonNull BootstrapBrand bootstrapBrand) {
this.bootstrapBrand = bootstrapBrand;
updateBootstrapState();
}
@NonNull @Override public BootstrapBrand getBootstrapBrand() {
return bootstrapBrand;
}
@Override public void setText(CharSequence text, BufferType type) {
super.setText(text, type);
bootstrapText = null;
}
@Override
protected void onTextChanged(CharSequence text, int start, int lengthBefore, int lengthAfter) {
super.onTextChanged(text, start, lengthBefore, lengthAfter);
if(!(text!=null && text.length()>0)){
setVisibility(GONE);
}else{
setVisibility(VISIBLE);
}
}
}
================================================
FILE: AndroidBootstrap/src/main/java/com/beardedhen/androidbootstrap/BetaApi.java
================================================
package com.beardedhen.androidbootstrap;
/**
* Any class marked with this annotation is subject to Major API changes which may cause client code
* to break between releases. Use with caution!!!
*/
public @interface BetaApi {}
================================================
FILE: AndroidBootstrap/src/main/java/com/beardedhen/androidbootstrap/BootstrapAlert.java
================================================
package com.beardedhen.androidbootstrap;
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.text.Html;
import android.util.AttributeSet;
import android.view.Gravity;
import android.view.TouchDelegate;
import android.view.View;
import android.view.animation.AccelerateInterpolator;
import android.view.animation.AlphaAnimation;
import android.view.animation.Animation;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;
import com.beardedhen.androidbootstrap.api.attributes.BootstrapBrand;
import com.beardedhen.androidbootstrap.api.defaults.DefaultBootstrapBrand;
import com.beardedhen.androidbootstrap.utils.DimenUtils;
import com.beardedhen.androidbootstrap.utils.ViewUtils;
import java.util.concurrent.atomic.AtomicInteger;
/**
* See
* <a href="http://getbootstrap.com/components/#badges">http://getbootstrap.com/components/#alerts</a>
*/
@BetaApi
public class BootstrapAlert extends RelativeLayout implements Animation.AnimationListener {
/**
* Provides methods which receive callbacks in response to changes in the view visibility.
*/
public interface VisibilityChangeListener{
/**
* Called when the alert is set to be dismissed with an animation.
* @param alert the alert
*/
void onAlertDismissStarted(BootstrapAlert alert);
/**
* Called when the alert is no longer visible.
* @param alert the alert
*/
void onAlertDismissCompletion(BootstrapAlert alert);
/**
* Called when the alert set to appear with an animation
* @param alert the alert
*/
void onAlertAppearStarted(BootstrapAlert alert);
/**
* Called when the alert is now visible.
* @param alert the alert
*/
void onAlertAppearCompletion(BootstrapAlert alert);
}
private ImageView closeButton;
private BootstrapBrand bootstrapBrand;
private String strongText;
private String messageText;
private float baselineFontSize;
private float baselinePadding;
private AlphaAnimation fadeInAnimation;
private AlphaAnimation fadeOutAnimation;
private boolean userDismissible;
private VisibilityChangeListener visibilityChangeListener;
private static final AtomicInteger nextGeneratedId = new AtomicInteger(1);
public BootstrapAlert(Context context) {
super(context);
initialise(null);
}
public BootstrapAlert(Context context, AttributeSet attrs) {
super(context, attrs);
initialise(attrs);
}
public BootstrapAlert(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
initialise(attrs);
}
private void initialise(AttributeSet attrs) {
TypedArray a = getContext().obtainStyledAttributes(attrs, R.styleable.BootstrapAlert);
try {
int typeOrdinal = a.getInt(R.styleable.BootstrapAlert_bootstrapBrand, -1);
this.bootstrapBrand = DefaultBootstrapBrand.fromAttributeValue(typeOrdinal);
strongText = a.getString(R.styleable.BootstrapAlert_strongText);
messageText = a.getString(R.styleable.BootstrapAlert_messageText);
userDismissible = a.getBoolean(R.styleable.BootstrapAlert_dismissible, false);
if (strongText == null) {
strongText = "";
}
if (messageText == null) {
messageText = "";
}
}
finally {
a.recycle();
}
baselineFontSize = DimenUtils.pixelsFromSpResource(getContext(),
R.dimen.bootstrap_button_default_font_size);
baselinePadding = DimenUtils.pixelsFromDpResource(getContext(),
R.dimen.bootstrap_alert_paddings);
setupAnimations();
updateBootstrapState();
}
private void updateBootstrapState() {
TextView alertText = new TextView(getContext());
closeButton = new ImageView(getContext());
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN_MR1) {
alertText.setId(generateViewUniqueId());
closeButton.setId(generateViewUniqueId());
}
else {
alertText.setId(View.generateViewId());
closeButton.setId(View.generateViewId());
}
LayoutParams textParams = new LayoutParams(LayoutParams.MATCH_PARENT,
LayoutParams.WRAP_CONTENT);
LayoutParams closeParams = new LayoutParams(LayoutParams.WRAP_CONTENT,
LayoutParams.WRAP_CONTENT);
textParams.addRule(RelativeLayout.LEFT_OF, closeButton.getId());
closeParams.addRule(RelativeLayout.ALIGN_PARENT_RIGHT, RelativeLayout.TRUE);
alertText.setLayoutParams(textParams);
alertText.setTextSize(baselineFontSize);
alertText.setGravity(Gravity.START);
alertText.setTextColor(
BootstrapDrawableFactory.bootstrapButtonText(getContext(), true, bootstrapBrand));
alertText.setText(Html.fromHtml(String.format("<b>%s</b>%s", strongText,
(strongText.length() > 0 ?
" " + messageText :
messageText))));
closeButton.setLayoutParams(closeParams);
Drawable buttonBg = BootstrapDrawableFactory.bootstrapAlertCloseIcon(
getContext(), (int) baselineFontSize, (int) baselineFontSize,
DimenUtils.dpToPixels(6));
ViewUtils.setBackgroundDrawable(closeButton, buttonBg);
Drawable bg = BootstrapDrawableFactory.bootstrapAlert(getContext(), bootstrapBrand);
ViewUtils.setBackgroundDrawable(this, bg);
addView(alertText);
if (userDismissible) {
addView(closeButton);
((View) closeButton.getParent()).post(new Runnable() {
@Override
public void run() {
Rect bounds = new Rect();
closeButton.getHitRect(bounds);
bounds.top -= DimenUtils.dpToPixels(6);
bounds.bottom += DimenUtils.dpToPixels(6);
bounds.left -= DimenUtils.dpToPixels(6);
bounds.right += DimenUtils.dpToPixels(6);
TouchDelegate touchDelegate = new TouchDelegate(bounds, closeButton);
if (View.class.isInstance(closeButton.getParent())) {
((View) closeButton.getParent()).setTouchDelegate(touchDelegate);
}
}
});
closeButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
dismiss(true);
}
});
}
int vert = (int) (baselinePadding * 1.5);
int hori = (int) (baselinePadding * 1.5);
setPadding(hori, vert, hori, vert);
}
private void setupAnimations() {
fadeInAnimation = new AlphaAnimation(0.0f, 1.0f);
fadeInAnimation.setDuration(300);
fadeInAnimation.setInterpolator(new AccelerateInterpolator());
fadeInAnimation.setAnimationListener(this);
fadeOutAnimation = new AlphaAnimation(1.0f, 0.0f);
fadeOutAnimation.setDuration(300);
fadeOutAnimation.setInterpolator(new AccelerateInterpolator());
fadeOutAnimation.setAnimationListener(this);
}
/**
* Hides the alert with an animation, setting its visibility to {@link View#GONE}
* @param animated whether the dismissal should be animated or not
*/
public void dismiss(boolean animated) {
if (animated) {
if (visibilityChangeListener != null) {
visibilityChangeListener.onAlertDismissStarted(this);
}
startAnimation(fadeOutAnimation);
}
else {
setVisibility(GONE);
}
}
/**
* Shows the alert with an animation, setting its visibility to {@link View#VISIBLE}
* @param animated whether the appearance should be animated or not
*/
public void show(boolean animated) {
if (animated) {
if (visibilityChangeListener != null) {
visibilityChangeListener.onAlertAppearStarted(this);
}
startAnimation(fadeInAnimation);
}
else {
setVisibility(VISIBLE);
}
}
/**
* Retrieves whether the user can dismiss the dialog or not
* @return true if dismissable
*/
public boolean isUserDismissible() {
return userDismissible;
}
/**
* Sets whether the user can dismiss the dialog or not.
* @param userDismissible true if dismissable
*/
public void setUserDismissible(boolean userDismissible) {
this.userDismissible = userDismissible;
updateBootstrapState();
}
/**
* Sets a {@link VisibilityChangeListener} that will be notified on changes
*
* @param visibilityChangeListener the listener
*/
public void setVisibilityChangeListener(VisibilityChangeListener visibilityChangeListener) {
this.visibilityChangeListener = visibilityChangeListener;
}
private int generateViewUniqueId() {
for (; ; ) {
final int result = nextGeneratedId.get();
// aapt-generated IDs have the high byte nonzero; clamp to the range under that.
int newValue = result + 1;
if (newValue > 0x00FFFFFF) {
newValue = 1; // Roll over to 1, not 0.
}
if (nextGeneratedId.compareAndSet(result, newValue)) {
return result;
}
}
}
@Override
public void setVisibility(int visibility) {
super.setVisibility(visibility);
if (visibilityChangeListener != null) {
if (GONE == visibility) {
visibilityChangeListener.onAlertDismissCompletion(this);
}
else if (VISIBLE == visibility) {
visibilityChangeListener.onAlertAppearCompletion(this);
}
}
}
// Animation change listener
@Override
public void onAnimationStart(Animation animation) {
}
@Override
public void onAnimationEnd(Animation animation) {
if (animation == fadeInAnimation) {
setVisibility(VISIBLE);
}
else if (animation == fadeOutAnimation) {
setVisibility(GONE);
}
else {
throw new IllegalStateException("Unsupported animation attempted to use this listener");
}
}
@Override
public void onAnimationRepeat(Animation animation) {
}
}
================================================
FILE: AndroidBootstrap/src/main/java/com/beardedhen/androidbootstrap/BootstrapBadge.java
================================================
package com.beardedhen.androidbootstrap;
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.drawable.Drawable;
import android.support.annotation.NonNull;
import android.util.AttributeSet;
import android.widget.ImageView;
import com.beardedhen.androidbootstrap.api.attributes.BootstrapBrand;
import com.beardedhen.androidbootstrap.api.defaults.DefaultBootstrapBrand;
import com.beardedhen.androidbootstrap.api.defaults.DefaultBootstrapSize;
import com.beardedhen.androidbootstrap.api.view.BootstrapBadgeView;
import com.beardedhen.androidbootstrap.api.view.BootstrapBrandView;
import com.beardedhen.androidbootstrap.api.view.BootstrapSizeView;
import com.beardedhen.androidbootstrap.utils.DimenUtils;
import com.beardedhen.androidbootstrap.utils.ViewUtils;
/**
* See
*
* <a href="http://getbootstrap.com/components/#badges">http://getbootstrap.com/components/#badges</a>
*/
@BetaApi
public class BootstrapBadge extends ImageView implements BootstrapSizeView, BootstrapBrandView,
BootstrapBadgeView {
private String badgeText;
private int size;
private boolean insideContainer;
private BootstrapBrand bootstrapBrand = DefaultBootstrapBrand.REGULAR;
private float bootstrapSize;
private Drawable badgeDrawable;
public BootstrapBadge(Context context) {
super(context);
init(null);
}
public BootstrapBadge(Context context, AttributeSet attrs) {
super(context, attrs);
init(attrs);
}
public BootstrapBadge(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
init(attrs);
}
private void init(AttributeSet attrs) {
TypedArray a = getContext().obtainStyledAttributes(attrs, R.styleable.BootstrapBadge);
try {
int sizeOrdinal = a.getInt(R.styleable.BootstrapBadge_bootstrapSize, -1);
if (badgeText == null) {
badgeText = a.getString(R.styleable.BootstrapBadge_badgeText);
}
bootstrapSize = DefaultBootstrapSize.fromAttributeValue(sizeOrdinal)
.scaleFactor();
}
finally {
a.recycle();
}
size = (int) DimenUtils.pixelsFromDpResource(getContext(), R.dimen.bootstrap_badge_default_size);
updateBootstrapState();
}
private void updateBootstrapState() {
badgeDrawable = BootstrapDrawableFactory.createBadgeDrawable(getContext(), bootstrapBrand,
(int) (size * bootstrapSize),
(int) (size * bootstrapSize),
badgeText,
insideContainer);
ViewUtils.setBackgroundDrawable(this, badgeDrawable);
}
Drawable getBadgeDrawable() {
return badgeDrawable;
}
@Override public String getBadgeText() {
return badgeText;
}
@Override public void setBadgeText(String badgeText) {
this.badgeText = badgeText;
updateBootstrapState();
}
public void setBootstrapBrand(BootstrapBrand bootstrapBrand, boolean insideContainer) {
this.insideContainer = insideContainer;
setBootstrapBrand(bootstrapBrand);
}
@Override
public void setBootstrapBrand(@NonNull BootstrapBrand bootstrapBrand) {
this.bootstrapBrand = bootstrapBrand;
updateBootstrapState();
}
@NonNull
@Override
public BootstrapBrand getBootstrapBrand() {
return bootstrapBrand;
}
@Override
public void setBootstrapSize(DefaultBootstrapSize bootstrapSize) {
this.bootstrapSize = bootstrapSize.scaleFactor();
updateBootstrapState();
}
@Override
public void setBootstrapSize(float bootstrapSize) {
this.bootstrapSize = bootstrapSize;
updateBootstrapState();
}
@Override
public float getBootstrapSize() {
return bootstrapSize;
}
}
================================================
FILE: AndroidBootstrap/src/main/java/com/beardedhen/androidbootstrap/BootstrapBaseThumbnail.java
================================================
package com.beardedhen.androidbootstrap;
import android.annotation.TargetApi;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.net.Uri;
import android.os.Bundle;
import android.os.Parcelable;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.util.AttributeSet;
import android.widget.ImageView;
import com.beardedhen.androidbootstrap.api.attributes.BootstrapBrand;
import com.beardedhen.androidbootstrap.api.defaults.DefaultBootstrapSize;
import com.beardedhen.androidbootstrap.api.view.BootstrapBrandView;
import com.beardedhen.androidbootstrap.api.view.BootstrapSizeView;
import com.beardedhen.androidbootstrap.api.view.BorderView;
import com.beardedhen.androidbootstrap.utils.ColorUtils;
import com.beardedhen.androidbootstrap.utils.DimenUtils;
import java.io.Serializable;
import static android.widget.ImageView.ScaleType.CENTER_CROP;
/**
* Parent class of Circle and Square Thumbnails - contains boilerplate code required to get
* BootstrapBrand and borders working via getters/setters. Also overrides ImageView so that only
* CENTER_CROP is allowed, and a callback is fired whenever the image source changes.
*/
abstract class BootstrapBaseThumbnail extends ImageView implements BootstrapBrandView,
BorderView, BootstrapSizeView {
private static final String TAG = "com.beardedhen.androidbootstrap.BootstrapBaseThumbnail";
protected BootstrapBrand bootstrapBrand;
protected boolean hasBorder;
protected float baselineBorderWidth;
protected float baselineOuterBorderWidth;
protected float bootstrapSize;
protected Bitmap sourceBitmap;
protected final Paint placeholderPaint = new Paint();
protected final Paint borderPaint = new Paint();
protected final Paint imagePaint = new Paint();
public BootstrapBaseThumbnail(Context context) {
super(context);
initialise(null);
}
public BootstrapBaseThumbnail(Context context, AttributeSet attrs) {
super(context, attrs);
initialise(attrs);
}
public BootstrapBaseThumbnail(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
initialise(attrs);
}
protected void initialise(AttributeSet attrs) {
this.baselineOuterBorderWidth = DimenUtils.pixelsFromDpResource(getContext(), R.dimen.bthumbnail_outer_stroke);
this.baselineBorderWidth = DimenUtils.pixelsFromDpResource(getContext(), R.dimen.bthumbnail_default_border);
setupPaints();
updateImageState();
}
@Override public Parcelable onSaveInstanceState() {
Bundle bundle = new Bundle();
bundle.putParcelable(TAG, super.onSaveInstanceState());
bundle.putSerializable(BootstrapBrandView.KEY, bootstrapBrand);
bundle.putBoolean(BorderView.KEY_DISPLAYED, hasBorder);
bundle.putFloat(BootstrapSizeView.KEY, bootstrapSize);
return bundle;
}
@Override public void onRestoreInstanceState(Parcelable state) {
if (state instanceof Bundle) {
Bundle bundle = (Bundle) state;
this.hasBorder = bundle.getBoolean(BorderView.KEY_DISPLAYED);
this.bootstrapSize = bundle.getFloat(BootstrapSizeView.KEY);
Serializable brand = bundle.getSerializable(BootstrapBrandView.KEY);
if (brand instanceof BootstrapBrand) {
this.bootstrapBrand = (BootstrapBrand) brand;
}
state = bundle.getParcelable(TAG);
}
super.onRestoreInstanceState(state);
updateImageState();
}
private void setupPaints() {
int strokeColor = bootstrapBrand.defaultEdge(getContext());
int placeholderColor = ColorUtils.resolveColor(R.color.bootstrap_gray_light, getContext());
borderPaint.setColor(strokeColor);
borderPaint.setAntiAlias(true);
borderPaint.setStrokeWidth(baselineBorderWidth);
borderPaint.setStyle(Paint.Style.STROKE);
imagePaint.setAntiAlias(true);
placeholderPaint.setColor(placeholderColor);
placeholderPaint.setAntiAlias(true);
placeholderPaint.setStyle(Paint.Style.FILL);
}
@Override protected void onSizeChanged(int w, int h, int oldw, int oldh) {
super.onSizeChanged(w, h, oldw, oldh);
updateImageState();
}
@Override public void setScaleType(ScaleType scaleType) {
if (scaleType != CENTER_CROP) {
throw new IllegalArgumentException("Only CenterCrop is currently supported by this view");
}
else {
super.setScaleType(scaleType);
}
}
@Override public ScaleType getScaleType() {
return CENTER_CROP;
}
/**
* @return the original Bitmap source that will be drawn as a circular image
*/
@Nullable private Bitmap getBitmapForView() {
Drawable drawable = getDrawable();
if (drawable == null) {
return null;
}
if (drawable instanceof BitmapDrawable) {
return ((BitmapDrawable) drawable).getBitmap();
}
else {
int w = drawable.getIntrinsicWidth();
int h = drawable.getIntrinsicHeight();
Bitmap bm = Bitmap.createBitmap(w, h, Bitmap.Config.ARGB_8888);
drawable.draw(new Canvas(bm));
return bm;
}
}
/*
* Image setter overrides
*/
@Override public void setImageBitmap(Bitmap bm) {
super.setImageBitmap(bm);
this.sourceBitmap = bm;
updateImageState();
}
@Override public void setImageDrawable(Drawable drawable) {
super.setImageDrawable(drawable);
this.sourceBitmap = getBitmapForView();
updateImageState();
}
@Override public void setImageResource(int resId) {
super.setImageResource(resId);
this.sourceBitmap = getBitmapForView();
updateImageState();
}
@Override public void setImageURI(Uri uri) {
super.setImageURI(uri);
this.sourceBitmap = getBitmapForView();
updateImageState();
}
/**
* Called when the ImageView should alter its source bitmap, then invalidate itself.
*/
protected abstract void updateImageState();
/*
* Getters/Setters
*/
@Override public void setBootstrapBrand(@NonNull BootstrapBrand bootstrapBrand) {
this.bootstrapBrand = bootstrapBrand;
updateImageState();
}
@NonNull @Override public BootstrapBrand getBootstrapBrand() {
return bootstrapBrand;
}
@TargetApi(16) @Override public void setBorderDisplayed(boolean displayed) {
this.hasBorder = displayed;
updateImageState();
}
@Override public boolean isBorderDisplayed() {
return hasBorder;
}
@Override public float getBootstrapSize() {
return bootstrapSize;
}
@Override public void setBootstrapSize(float bootstrapSize) {
this.bootstrapSize = bootstrapSize;
updateImageState();
}
@Override public void setBootstrapSize(DefaultBootstrapSize bootstrapSize) {
setBootstrapSize(bootstrapSize.scaleFactor());
}
}
================================================
FILE: AndroidBootstrap/src/main/java/com/beardedhen/androidbootstrap/BootstrapButton.java
================================================
package com.beardedhen.androidbootstrap;
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.os.Parcelable;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.view.ViewParent;
import com.beardedhen.androidbootstrap.api.attributes.BootstrapBrand;
import com.beardedhen.androidbootstrap.api.attributes.ViewGroupPosition;
import com.beardedhen.androidbootstrap.api.defaults.ButtonMode;
import com.beardedhen.androidbootstrap.api.defaults.DefaultBootstrapSize;
import com.beardedhen.androidbootstrap.api.view.BadgeContainerView;
import com.beardedhen.androidbootstrap.api.view.BootstrapBadgeView;
import com.beardedhen.androidbootstrap.api.view.BootstrapSizeView;
import com.beardedhen.androidbootstrap.api.view.ButtonModeView;
import com.beardedhen.androidbootstrap.api.view.OutlineableView;
import com.beardedhen.androidbootstrap.api.view.RoundableView;
import com.beardedhen.androidbootstrap.utils.DimenUtils;
import com.beardedhen.androidbootstrap.utils.ViewUtils;
import java.io.Serializable;
/**
* BootstrapButtons are regular buttons styled with BootstrapBrand colors, roundable corners, and an
* 'outlineable' mode. It is possible to group together multiple buttons using BootstrapButtonGroup,
* allowing the use of different selection modes e.g. Checkbox/Radio group.
*/
public class BootstrapButton extends AwesomeTextView implements BootstrapSizeView,
OutlineableView, RoundableView, ButtonModeView, BadgeContainerView,
BootstrapBadgeView {
/**
* instances of this can be used with .setOnCheckedChangedLisener to notify you when the state of a radio, togle or checkbox button has changed.
*/
public interface OnCheckedChangedListener{
/**
* This method will get called when the state of a radio button, checkbox or toggle button changes.
* @param bootstrapButton the view thats state is changing
* @param isChecked weather the button is checked or not.
*/
public void OnCheckedChanged(BootstrapButton bootstrapButton, boolean isChecked);
}
private static final String TAG = "com.beardedhen.androidbootstrap.BootstrapButton";
private static final String KEY_MODE = "com.beardedhen.androidbootstrap.BootstrapButton.MODE";
private static final String KEY_INDEX = "com.beardedhen.androidbootstrap.BootstrapButton.KEY_INDEX";
private int parentIndex;
private ViewGroupPosition viewGroupPosition = ViewGroupPosition.SOLO;
private ButtonMode buttonMode = ButtonMode.REGULAR;
private float bootstrapSize;
private boolean roundedCorners;
private boolean showOutline;
private boolean mustBeSelected;
private float baselineFontSize;
private float baselineVertPadding;
private float baselineHoriPadding;
private float baselineStrokeWidth;
private float baselineCornerRadius;
private BootstrapBadge bootstrapBadge;
private String badgeText;
private OnCheckedChangedListener onCheckedChangedListener;
public BootstrapButton(Context context) {
super(context);
initialise(null);
}
public BootstrapButton(Context context, AttributeSet attrs) {
super(context, attrs);
initialise(attrs);
}
public BootstrapButton(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
initialise(attrs);
}
private void initialise(AttributeSet attrs) {
TypedArray a = getContext().obtainStyledAttributes(attrs, R.styleable.BootstrapButton);
viewGroupPosition = ViewGroupPosition.SOLO;
try {
this.roundedCorners = a.getBoolean(R.styleable.BootstrapButton_roundedCorners, false);
this.showOutline = a.getBoolean(R.styleable.BootstrapButton_showOutline, false);
this.mustBeSelected = a.getBoolean(R.styleable.BootstrapButton_checked, false);
this.badgeText = a.getString(R.styleable.BootstrapButton_badgeText);
int sizeOrdinal = a.getInt(R.styleable.BootstrapButton_bootstrapSize, -1);
int modeOrdinal = a.getInt(R.styleable.BootstrapButton_buttonMode, -1);
bootstrapSize = DefaultBootstrapSize.fromAttributeValue(sizeOrdinal).scaleFactor();
buttonMode = ButtonMode.fromAttributeValue(modeOrdinal);
}
finally {
a.recycle();
}
baselineFontSize = DimenUtils.pixelsFromSpResource(getContext(), R.dimen.bootstrap_button_default_font_size);
baselineVertPadding = DimenUtils.pixelsFromDpResource(getContext(), R.dimen.bootstrap_button_default_vert_padding);
baselineHoriPadding = DimenUtils.pixelsFromDpResource(getContext(), R.dimen.bootstrap_button_default_hori_padding);
baselineStrokeWidth = DimenUtils.pixelsFromDpResource(getContext(), R.dimen.bootstrap_button_default_edge_width);
baselineCornerRadius = DimenUtils.pixelsFromDpResource(getContext(), R.dimen.bootstrap_button_default_corner_radius);
updateBootstrapState();
if (badgeText != null) {
setBadge(new BootstrapBadge(getContext()));
setBadgeText(badgeText);
}
}
@Override public Parcelable onSaveInstanceState() {
Bundle bundle = new Bundle();
bundle.putParcelable(TAG, super.onSaveInstanceState());
bundle.putBoolean(RoundableView.KEY, roundedCorners);
bundle.putBoolean(OutlineableView.KEY, showOutline);
bundle.putInt(KEY_INDEX, parentIndex);
bundle.putFloat(BootstrapSizeView.KEY, bootstrapSize);
bundle.putSerializable(KEY_MODE, buttonMode);
if (bootstrapBadge != null) {
bundle.putString(BadgeContainerView.KEY, bootstrapBadge
.getBadgeText());
}
return bundle;
}
@Override public void onRestoreInstanceState(Parcelable state) {
if (state instanceof Bundle) {
Bundle bundle = (Bundle) state;
this.roundedCorners = bundle.getBoolean(RoundableView.KEY);
this.showOutline = bundle.getBoolean(OutlineableView.KEY);
this.parentIndex = bundle.getInt(KEY_INDEX);
this.bootstrapSize = bundle.getFloat(BootstrapSizeView.KEY);
if (bootstrapBadge != null) {
setBadgeText(bundle.getString(BadgeContainerView.KEY));
}
Serializable m = bundle.getSerializable(KEY_MODE);
if (m instanceof ButtonMode) {
buttonMode = (ButtonMode) m;
}
}
super.onRestoreInstanceState(state);
}
@Override protected void updateBootstrapState() {
super.updateBootstrapState();
BootstrapBrand bootstrapBrand = getBootstrapBrand();
float cornerRadius = baselineCornerRadius;
float strokeWidth = baselineStrokeWidth;
final float fontSize = baselineFontSize * bootstrapSize;
setTextSize(fontSize);
cornerRadius *= bootstrapSize;
strokeWidth *= bootstrapSize;
setTextColor(BootstrapDrawableFactory.bootstrapButtonText(
getContext(),
showOutline,
bootstrapBrand));
Drawable bg = BootstrapDrawableFactory.bootstrapButton(
getContext(),
bootstrapBrand,
(int) strokeWidth,
(int) cornerRadius,
viewGroupPosition,
showOutline,
roundedCorners);
ViewUtils.setBackgroundDrawable(this, bg);
int vert = (int) (baselineVertPadding * bootstrapSize);
int hori = (int) (baselineHoriPadding * bootstrapSize);
setPadding(hori, vert, hori, vert);
}
@Override public boolean onTouchEvent(@NonNull MotionEvent event) {
switch (buttonMode) {
case REGULAR:
return super.onTouchEvent(event);
case TOGGLE:
return handleToggle(event);
case CHECKBOX:
return handleToggle(event);
case RADIO:
return handleRadioEvent(event);
default:
return super.onTouchEvent(event);
}
}
@Override
public void setSelected(boolean selected) {
super.setSelected(selected);
if (onCheckedChangedListener != null) {
onCheckedChangedListener.OnCheckedChanged(this, selected);
}
}
private boolean handleRadioEvent(@NonNull MotionEvent event) {
if (event.getAction() == MotionEvent.ACTION_DOWN) {
setSelected(true); // notify parent to deselect any peers
ViewParent parent = getParent();
if (parent instanceof BootstrapButtonGroup) {
((BootstrapButtonGroup) parent).onRadioToggle(parentIndex);
}
return true;
}
else {
return false;
}
}
private boolean handleToggle(@NonNull MotionEvent event) {
if (event.getAction() == MotionEvent.ACTION_DOWN) {
setSelected(!isSelected());
return true;
}
else {
return false;
}
}
/**
* Called by the ViewParent, notifies the child of its position so that it can update its
* drawable to match the position
*
* @param viewGroupPosition the position in the ViewGroup
*/
void setViewGroupPosition(ViewGroupPosition viewGroupPosition, int parentIndex) {
this.viewGroupPosition = viewGroupPosition;
this.parentIndex = parentIndex;
updateBootstrapState();
}
void updateFromParent(BootstrapBrand bootstrapBrand,
float bootstrapSize,
ButtonMode buttonMode,
boolean outline,
boolean rounded) { // called when viewparent attrs are updated
// called by BootstrapButtonGroup when updating state all at once
this.bootstrapSize = bootstrapSize;
this.buttonMode = buttonMode;
this.showOutline = outline;
this.roundedCorners = rounded;
setBootstrapBrand(bootstrapBrand);
updateBootstrapState();
}
@Override public void displayBadgeDrawable() {
if (bootstrapBadge != null) {
Drawable badgeDrawable = this.bootstrapBadge.getBadgeDrawable();
if (badgeDrawable != null) {
setCompoundDrawablesWithIntrinsicBounds(
null,
null, badgeDrawable,
null);
setCompoundDrawablePadding(DimenUtils.dpToPixels(4));
}
}
}
/*
* Getters/Setters
*/
public boolean isMustBeSelected() {
return mustBeSelected;
}
public void setChecked(boolean checked) {
this.mustBeSelected = checked;
}
@Override public boolean isShowOutline() {
return showOutline;
}
@Override public boolean isRounded() {
return roundedCorners;
}
@Override public void setShowOutline(boolean showOutline) {
this.showOutline = showOutline;
updateBootstrapState();
}
@Override public void setRounded(boolean rounded) {
this.roundedCorners = rounded;
updateBootstrapState();
}
@NonNull @Override public ButtonMode getButtonMode() {
return buttonMode;
}
@Override public void setButtonMode(@NonNull ButtonMode buttonMode) {
this.buttonMode = buttonMode;
}
@Override public void setBadge(BootstrapBadge badge) {
this.bootstrapBadge = badge;
this.bootstrapBadge.setBootstrapBrand(getBootstrapBrand(), true);
this.bootstrapBadge.setBootstrapSize(getBootstrapSize());
displayBadgeDrawable();
}
@Nullable
@Override
public String getBadgeText() {
return bootstrapBadge != null ? bootstrapBadge.getBadgeText() : null;
}
@Override
public void setBadgeText(@Nullable String badgeText) {
if (bootstrapBadge != null) {
this.badgeText = badgeText;
this.bootstrapBadge.setBadgeText(this.badgeText);
displayBadgeDrawable();
}
}
@Override public float getBootstrapSize() {
return bootstrapSize;
}
@Override public BootstrapBadge getBootstrapBadge() {
return bootstrapBadge;
}
@Override public void setBootstrapSize(DefaultBootstrapSize bootstrapSize) {
setBootstrapSize(bootstrapSize.scaleFactor());
}
@Override public void setBootstrapSize(float bootstrapSize) {
this.bootstrapSize = bootstrapSize;
updateBootstrapState();
}
/**
* NOTE this method only works if the buttons mode is not set to regular.
* for non Toggle, checkbox and radio see {@link BootstrapButton#setOnClickListener}
* @param listener OnCheckedChangedListener that will be fired when the schecked state ofa button is changed.
*/
public void setOnCheckedChangedListener(OnCheckedChangedListener listener){
onCheckedChangedListener = listener;
}
/**
* NOTE this method only works if the buttons mode is set to regular.
* for Toggle, checkbox and radio see {@link BootstrapButton#setOnCheckedChangedListener}
* @param l OnClickListener that will be fired on click.
*/
@Override
public void setOnClickListener(OnClickListener l) {
super.setOnClickListener(l);
}
}
================================================
FILE: AndroidBootstrap/src/main/java/com/beardedhen/androidbootstrap/BootstrapButtonGroup.java
================================================
package com.beardedhen.androidbootstrap;
import android.content.Context;
import android.content.res.TypedArray;
import android.os.Bundle;
import android.os.Parcelable;
import android.support.annotation.IdRes;
import android.support.annotation.NonNull;
import android.util.AttributeSet;
import android.view.View;
import com.beardedhen.androidbootstrap.api.attributes.BootstrapBrand;
import com.beardedhen.androidbootstrap.api.attributes.ViewGroupPosition;
import com.beardedhen.androidbootstrap.api.defaults.ButtonMode;
import com.beardedhen.androidbootstrap.api.defaults.DefaultBootstrapBrand;
import com.beardedhen.androidbootstrap.api.defaults.DefaultBootstrapSize;
import com.beardedhen.androidbootstrap.api.view.BootstrapBrandView;
import com.beardedhen.androidbootstrap.api.view.BootstrapSizeView;
import com.beardedhen.androidbootstrap.api.view.ButtonModeView;
import com.beardedhen.androidbootstrap.api.view.OutlineableView;
import com.beardedhen.androidbootstrap.api.view.RoundableView;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import static com.beardedhen.androidbootstrap.api.attributes.ViewGroupPosition.BOTTOM;
import static com.beardedhen.androidbootstrap.api.attributes.ViewGroupPosition.END;
import static com.beardedhen.androidbootstrap.api.attributes.ViewGroupPosition.MIDDLE_HORI;
import static com.beardedhen.androidbootstrap.api.attributes.ViewGroupPosition.MIDDLE_VERT;
import static com.beardedhen.androidbootstrap.api.attributes.ViewGroupPosition.SOLO;
import static com.beardedhen.androidbootstrap.api.attributes.ViewGroupPosition.START;
import static com.beardedhen.androidbootstrap.api.attributes.ViewGroupPosition.TOP;
/**
* BootstrapButtonGroups are a LinearLayout which exclusively holds BootstrapButtons. It is possible
* to set the properties of all children with one method call to this view. Options include
* BootstrapBrand colors, roundable corners, 'outlineable' mode and different selection modes
* e.g. Checkbox/Radio group.
* If button mode is set to radio only one button is a button group may be selected at a time.
*/
public class BootstrapButtonGroup extends BootstrapGroup implements BootstrapSizeView,
OutlineableView, RoundableView, BootstrapBrandView, ButtonModeView {
private static final String TAG = "com.beardedhen.androidbootstrap.BootstrapButtonGroup";
private static final String KEY_MODE = "com.beardedhen.androidbootstrap.BootstrapButtonGroup.MODE";
private float bootstrapSize;
private ButtonMode buttonMode;
private BootstrapBrand bootstrapBrand;
private boolean rounded;
private boolean outline;
private int checkedButtonId = 0;
public BootstrapButtonGroup(Context context) {
super(context);
initialise(null);
}
public BootstrapButtonGroup(Context context, AttributeSet attrs) {
super(context, attrs);
initialise(attrs);
}
public BootstrapButtonGroup(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
initialise(attrs);
}
protected void initialise(AttributeSet attrs) {
TypedArray a = getContext().obtainStyledAttributes(attrs, R.styleable.BootstrapButtonGroup);
try {
this.rounded = a.getBoolean(R.styleable.BootstrapButtonGroup_roundedCorners, false);
this.outline = a.getBoolean(R.styleable.BootstrapButtonGroup_showOutline, false);
int typeOrdinal = a.getInt(R.styleable.BootstrapButtonGroup_buttonMode, -1);
int brandOrdinal = a.getInt(R.styleable.BootstrapButtonGroup_bootstrapBrand, -1);
int sizeOrdinal = a.getInt(R.styleable.BootstrapButtonGroup_bootstrapSize, -1);
this.checkedButtonId = a.getResourceId(R.styleable.BootstrapButtonGroup_checkedButton, 0);
this.buttonMode = ButtonMode.fromAttributeValue(typeOrdinal);
this.bootstrapBrand = DefaultBootstrapBrand.fromAttributeValue(brandOrdinal);
this.bootstrapSize = DefaultBootstrapSize.fromAttributeValue(sizeOrdinal).scaleFactor();
}
finally {
a.recycle();
}
updateBootstrapGroup();
}
@Override public Parcelable onSaveInstanceState() {
Bundle bundle = new Bundle();
bundle.putParcelable(TAG, super.onSaveInstanceState());
bundle.putSerializable(KEY_MODE, buttonMode);
bundle.putSerializable(BootstrapBrand.KEY, bootstrapBrand);
bundle.putBoolean(RoundableView.KEY, rounded);
bundle.putBoolean(OutlineableView.KEY, outline);
return bundle;
}
@Override public void onRestoreInstanceState(Parcelable state) {
if (state instanceof Bundle) {
Bundle bundle = (Bundle) state;
outline = bundle.getBoolean(OutlineableView.KEY);
rounded = bundle.getBoolean(RoundableView.KEY);
Serializable brand = bundle.getSerializable(BootstrapBrand.KEY);
Serializable m = bundle.getSerializable(KEY_MODE);
if (m instanceof ButtonMode) {
buttonMode = (ButtonMode) m;
}
if (brand instanceof BootstrapBrand) {
bootstrapBrand = (BootstrapBrand) brand;
}
state = bundle.getParcelable(TAG);
}
super.onRestoreInstanceState(state);
updateBootstrapGroup();
}
@Override
protected void onBootstrapViewAdded() {
updateBootstrapGroup();
}
@Override
protected void onBootstrapViewRemoved() {
updateBootstrapGroup();
}
protected void updateBootstrapGroup() {
int childCount = getChildCount();
int orientation = getOrientation();
// tell children their position so they can draw backgrounds appropriately
if (childCount == 0) {
return;
}
else if (childCount == 1) {
BootstrapButton button = retrieveButtonChild(0);
button.setViewGroupPosition(SOLO, 0);
}
List<BootstrapButton> buttonList = new ArrayList<>();
for (int i = 0; i < childCount; i++) {
BootstrapButton button = retrieveButtonChild(i);
if (button.getVisibility() == VISIBLE) {
buttonList.add(button);
}
}
final int size = buttonList.size();
for (int i = 0; i < size; i++) {
BootstrapButton button = buttonList.get(i);
ViewGroupPosition position;
if (i == 0) { // first view
position = orientation == HORIZONTAL ? START : TOP;
}
else if (i == size - 1) { // last view
position = orientation == HORIZONTAL ? END : BOTTOM;
}
else {
position = orientation == HORIZONTAL ? MIDDLE_HORI : MIDDLE_VERT;
}
button.setViewGroupPosition(position, i);
button.updateFromParent(bootstrapBrand, bootstrapSize, buttonMode, outline, rounded);
if (buttonMode == ButtonMode.RADIO && button.isMustBeSelected()) {
button.setSelected(true);
onRadioToggle(i);
checkedButtonId = 0; //BootstrapButton "checked" attribute is preferable
}
else if (buttonMode == ButtonMode.RADIO && button.getId() == checkedButtonId) {
button.setSelected(true);
onRadioToggle(i);
}
}
}
private BootstrapButton retrieveButtonChild(int i) {
View view = getChildAt(i);
if ((view instanceof BootstrapButton)) {
return (BootstrapButton) view;
}
else {
throw new IllegalStateException("All child view of BootstrapButtonGroup must be BootstrapButtons");
}
}
/**
* Used for Radio Group Mode - resets all children to an unselected state,
* apart from the calling Button.
*
* @param index the index of the button becoming selected
*/
void onRadioToggle(int index) {
for (int i = 0; i < getChildCount(); i++) {
if (i != index) {
BootstrapButton b = retrieveButtonChild(i);
b.setSelected(false);
}
}
}
/*
* Getters / Setters
*/
public void check(@IdRes int id) {
this.checkedButtonId = id;
}
@Override public float getBootstrapSize() {
return bootstrapSize;
}
@Override public void setBootstrapSize(DefaultBootstrapSize bootstrapSize) {
setBootstrapSize(bootstrapSize.scaleFactor());
}
@Override public void setBootstrapSize(float bootstrapSize) {
this.bootstrapSize = bootstrapSize;
for (int i = 0; i < getChildCount(); i++) {
BootstrapButton button = retrieveButtonChild(i);
button.setBootstrapSize(this.bootstrapSize);
}
}
@NonNull public ButtonMode getButtonMode() {
return buttonMode;
}
public void setButtonMode(@NonNull ButtonMode buttonMode) {
this.buttonMode = buttonMode;
for (int i = 0; i < getChildCount(); i++) {
BootstrapButton button = retrieveButtonChild(i);
button.setButtonMode(buttonMode);
}
}
@Override public void setBootstrapBrand(@NonNull BootstrapBrand bootstrapBrand) {
this.bootstrapBrand = bootstrapBrand;
for (int i = 0; i < getChildCount(); i++) {
BootstrapButton button = retrieveButtonChild(i);
button.setBootstrapBrand(bootstrapBrand);
}
}
@NonNull @Override public BootstrapBrand getBootstrapBrand() {
return bootstrapBrand;
}
@Override public void setShowOutline(boolean showOutline) {
this.outline = showOutline;
for (int i = 0; i < getChildCount(); i++) {
BootstrapButton button = retrieveButtonChild(i);
button.setShowOutline(outline);
}
}
@Override public boolean isShowOutline() {
return outline;
}
@Override public void setRounded(boolean rounded) {
this.rounded = rounded;
for (int i = 0; i < getChildCount(); i++) {
BootstrapButton button = retrieveButtonChild(i);
button.setRounded(rounded);
}
}
@Override public boolean isRounded() {
return rounded;
}
}
================================================
FILE: AndroidBootstrap/src/main/java/com/beardedhen/androidbootstrap/BootstrapCircleThumbnail.java
================================================
package com.beardedhen.androidbootstrap;
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.BitmapShader;
import android.graphics.Canvas;
import android.graphics.Matrix;
import android.graphics.Paint;
import android.graphics.RectF;
import android.graphics.Shader;
import android.graphics.drawable.Drawable;
import android.support.annotation.NonNull;
import android.util.AttributeSet;
import com.beardedhen.androidbootstrap.api.defaults.DefaultBootstrapBrand;
import com.beardedhen.androidbootstrap.api.defaults.DefaultBootstrapSize;
import com.beardedhen.androidbootstrap.utils.ColorUtils;
import com.beardedhen.androidbootstrap.utils.DimenUtils;
import com.beardedhen.androidbootstrap.utils.ViewUtils;
/**
* BootstrapCircleThumbnails display a circular image with an optional border, that can be themed
* using BootstrapBrand colors. The view extends ImageView, and will automatically center crop and
* scale images.
*/
public class BootstrapCircleThumbnail extends BootstrapBaseThumbnail {
private static final String TAG = "com.beardedhen.androidbootstrap.BootstrapCircleThumbnail";
private final RectF imageRectF = new RectF();
private final Matrix matrix = new Matrix();
public BootstrapCircleThumbnail(Context context) {
super(context);
initialise(null);
}
public BootstrapCircleThumbnail(Context context, AttributeSet attrs) {
super(context, attrs);
initialise(attrs);
}
public BootstrapCircleThumbnail(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
initialise(attrs);
}
protected void initialise(AttributeSet attrs) {
TypedArray a = getContext().obtainStyledAttributes(attrs, R.styleable.BootstrapCircleThumbnail);
try {
int typeOrdinal = a.getInt(R.styleable.BootstrapCircleThumbnail_bootstrapBrand, -1);
int sizeOrdinal = a.getInt(R.styleable.BootstrapCircleThumbnail_bootstrapSize, -1);
this.hasBorder = a.getBoolean(R.styleable.BootstrapCircleThumbnail_hasBorder, true);
this.bootstrapSize = DefaultBootstrapSize.fromAttributeValue(sizeOrdinal).scaleFactor();
if (typeOrdinal == -1) { // override to use Primary for default border (looks nicer)
this.bootstrapBrand = DefaultBootstrapBrand.PRIMARY;
}
else {
this.bootstrapBrand = DefaultBootstrapBrand.fromAttributeValue(typeOrdinal);
}
}
finally {
a.recycle();
}
baselineOuterBorderWidth = DimenUtils.pixelsFromDpResource(getContext(), R.dimen.bthumbnail_outer_stroke);
super.initialise(attrs);
}
/**
* This method is called when the Circle Image needs to be recreated due to changes in size etc.
* A Paint object uses a BitmapShader to draw a center-cropped, circular image onto the View
* Canvas. A Matrix on the BitmapShader scales the original Bitmap to match the current view
* bounds, avoiding any inefficiencies in duplicating Bitmaps.
* <a href="http://www.curious-creature.com/2012/12/11/android-recipe-1-image-with-rounded-corners">
* Further reading</a>
*/
protected void updateImageState() {
float viewWidth = getWidth();
float viewHeight = getHeight();
if ((int) viewWidth <= 0 || (int) viewHeight <= 0) {
return;
}
if (sourceBitmap != null) {
BitmapShader imageShader = new BitmapShader(sourceBitmap, Shader.TileMode.CLAMP, Shader.TileMode.CLAMP);
imagePaint.setShader(imageShader);
// Scale the bitmap using a matrix, ensuring that it always matches the view bounds.
float bitmapWidth = sourceBitmap.getWidth();
float bitmapHeight = sourceBitmap.getHeight();
float scaleFactor = (bitmapWidth < bitmapHeight) ? bitmapWidth : bitmapHeight;
float xScale = viewWidth / scaleFactor;
float yScale = viewHeight / scaleFactor;
// Translate image to center crop (if it is not a perfect square bitmap)
float dx = 0;
float dy = 0;
if (bitmapWidth > bitmapHeight) {
dx = (viewWidth - bitmapWidth * xScale) * 0.5f;
}
else if (bitmapHeight > bitmapWidth) {
dy = (viewHeight - bitmapHeight * yScale) * 0.5f;
}
matrix.set(null);
matrix.setScale(xScale, yScale);
matrix.postTranslate((dx + 0.5f), (dy + 0.5f));
imageShader.setLocalMatrix(matrix);
imageRectF.set(0, 0, viewWidth, viewHeight);
}
updateBackground();
invalidate();
}
@Override protected void onDraw(@NonNull Canvas canvas) {
float viewWidth = getWidth();
float viewHeight = getHeight();
if ((int) viewWidth <= 0 || (int) viewHeight <= 0) {
return;
}
boolean isPlaceholder = sourceBitmap == null;
// draw the image paint first, then draw a border as a Stroke paint (if needed)
float center = viewWidth / 2;
float imageRadius = center;
if (hasBorder) {
imageRadius -= (baselineBorderWidth * bootstrapSize);
}
Paint paint = (isPlaceholder) ? placeholderPaint : imagePaint;
canvas.drawCircle(center, center, imageRadius, paint);
}
@Override protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
int w = MeasureSpec.getSize(widthMeasureSpec); // AT_MOST/EXACTLY are used by default
int h = MeasureSpec.getSize(heightMeasureSpec);
if (sourceBitmap != null) {
if (MeasureSpec.getMode(widthMeasureSpec) == MeasureSpec.UNSPECIFIED) {
w = sourceBitmap.getWidth();
}
if (MeasureSpec.getMode(heightMeasureSpec) == MeasureSpec.UNSPECIFIED) {
h = sourceBitmap.getHeight();
}
}
if (w > h) { // no ovals allowed
w = h;
}
if (h > w) {
h = w;
}
setMeasuredDimension(w, h);
}
private void updateBackground() {
Drawable bg = null;
if (hasBorder) {
bg = BootstrapDrawableFactory.bootstrapCircleThumbnail(
getContext(),
bootstrapBrand,
(int) (baselineOuterBorderWidth * bootstrapSize),
ColorUtils.resolveColor(R.color.bootstrap_thumbnail_background, getContext()));
}
ViewUtils.setBackgroundDrawable(this, bg);
}
}
================================================
FILE: AndroidBootstrap/src/main/java/com/beardedhen/androidbootstrap/BootstrapDrawableFactory.java
================================================
package com.beardedhen.androidbootstrap;
import android.content.Context;
import android.content.res.ColorStateList;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Path;
import android.graphics.Rect;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.GradientDrawable;
import android.graphics.drawable.LayerDrawable;
import android.graphics.drawable.StateListDrawable;
import android.os.Build;
import android.support.annotation.ColorInt;
import android.text.TextPaint;
import com.beardedhen.androidbootstrap.api.attributes.BootstrapBrand;
import com.beardedhen.androidbootstrap.api.attributes.ViewGroupPosition;
import com.beardedhen.androidbootstrap.api.defaults.DefaultBootstrapBrand;
import com.beardedhen.androidbootstrap.api.defaults.ExpandDirection;
import com.beardedhen.androidbootstrap.utils.ColorUtils;
import com.beardedhen.androidbootstrap.utils.DimenUtils;
/**
* Provides a factory for generating Drawables which are used as the backgrounds for Bootstrap Views.
* This avoids needing to define hundreds of XML resource files.
*/
class BootstrapDrawableFactory {
/**
* Generates a background drawable for a Bootstrap Button
*
* @param context the current context
* @param brand the bootstrap brand
* @param strokeWidth the stroke width in px
* @param cornerRadius the corner radius in px
* @param position the position of the button in its parent view
* @param showOutline whether the button should be outlined
* @param rounded whether the corners should be rounded
* @return a background drawable for the BootstrapButton
*/
static Drawable bootstrapButton(Context context,
BootstrapBrand brand,
int strokeWidth,
int cornerRadius,
ViewGroupPosition position,
boolean showOutline,
boolean rounded) {
GradientDrawable defaultGd = new GradientDrawable();
GradientDrawable activeGd = new GradientDrawable();
GradientDrawable disabledGd = new GradientDrawable();
defaultGd.setColor(showOutline ? Color.TRANSPARENT : brand.defaultFill(context));
activeGd.setColor(showOutline ? brand.activeFill(context) : brand.activeFill(context));
disabledGd.setColor(showOutline ? Color.TRANSPARENT : brand.disabledFill(context));
defaultGd.setStroke(strokeWidth, brand.defaultEdge(context));
activeGd.setStroke(strokeWidth, brand.activeEdge(context));
disabledGd.setStroke(strokeWidth, brand.disabledEdge(context));
if (showOutline && brand instanceof DefaultBootstrapBrand) {
DefaultBootstrapBrand db = (DefaultBootstrapBrand) brand;
if (db == DefaultBootstrapBrand.SECONDARY) {
int color = ColorUtils.resolveColor(R.color.bootstrap_brand_secondary_border, context);
defaultGd.setStroke(strokeWidth, color);
activeGd.setStroke(strokeWidth, color);
disabledGd.setStroke(strokeWidth, color);
}
}
setupDrawableCorners(position, rounded, cornerRadius, defaultGd, activeGd, disabledGd);
return setupStateDrawable(position, strokeWidth, defaultGd, activeGd, disabledGd);
}
/**
* Generates a Drawable for a Bootstrap Label background, according to state parameters
*
* @param context the current context
* @param bootstrapBrand the BootstrapBrand theming whose colors should be used
* @param rounded whether the corners should be rounded or not
* @param height the view height in px
* @return the Bootstrap Label background
*/
static Drawable bootstrapLabel(Context context,
BootstrapBrand bootstrapBrand,
boolean rounded,
float height) {
int cornerRadius = (int) DimenUtils.pixelsFromDpResource(context, R.dimen.bootstrap_default_corner_radius);
GradientDrawable drawable = new GradientDrawable();
drawable.setColor(bootstrapBrand.defaultFill(context));
// corner radius should be half height if rounded as a "Pill" label
drawable.setCornerRadius(rounded ? height / 2 : cornerRadius);
return drawable;
}
/**
* Generates a Drawable for a Bootstrap Edit Text background
*
* @param context the current context
* @param bootstrapBrand the BootstrapBrand theming whose colors should be used
* @param rounded whether the corners should be rounded or not
* @return the Bootstrap Edit Text background
*/
static Drawable bootstrapEditText(Context context,
BootstrapBrand bootstrapBrand,
float strokeWidth,
float cornerRadius,
boolean rounded) {
StateListDrawable drawable = new StateListDrawable();
GradientDrawable activeDrawable = new GradientDrawable();
GradientDrawable disabledDrawable = new GradientDrawable();
GradientDrawable defaultDrawable = new GradientDrawable();
activeDrawable.setColor(ColorUtils.resolveColor(android.R.color.white, context));
disabledDrawable.setColor(ColorUtils.resolveColor(android.R.color.white, context));
defaultDrawable.setColor(ColorUtils.resolveColor(android.R.color.white, context));
if (rounded) {
activeDrawable.setCornerRadius(cornerRadius);
disabledDrawable.setCornerRadius(cornerRadius);
defaultDrawable.setCornerRadius(cornerRadius);
}
// stroke is larger when focused
int defaultBorder = ColorUtils.resolveColor(R.color.bootstrap_brand_secondary_border, context);
int disabledBorder = ColorUtils.resolveColor(R.color.bootstrap_edittext_disabled, context);
activeDrawable.setStroke((int) strokeWidth, bootstrapBrand.defaultEdge(context));
disabledDrawable.setStroke((int) strokeWidth, disabledBorder);
defaultDrawable.setStroke((int) strokeWidth, defaultBorder);
drawable.addState(new int[]{android.R.attr.state_focused}, activeDrawable);
drawable.addState(new int[]{-android.R.attr.state_enabled}, disabledDrawable);
drawable.addState(new int[]{}, defaultDrawable);
return drawable;
}
static Drawable bootstrapCircleThumbnail(Context context,
BootstrapBrand bootstrapBrand,
@ColorInt int outerBorderWidth,
@ColorInt int bg) {
GradientDrawable drawable = new GradientDrawable();
drawable.setShape(GradientDrawable.OVAL);
drawable.setColor(bg);
drawable.setStroke(outerBorderWidth, bootstrapBrand.defaultEdge(context));
return drawable;
}
static Drawable bootstrapThumbnail(Context context,
BootstrapBrand bootstrapBrand,
@ColorInt int outerBorderWidth,
@ColorInt int bg,
boolean rounded) {
GradientDrawable drawable = new GradientDrawable();
drawable.setShape(GradientDrawable.RECTANGLE);
drawable.setColor(bg);
drawable.setStroke(outerBorderWidth, bootstrapBrand.defaultEdge(context));
float r = DimenUtils.pixelsFromDpResource(context, R.dimen.bthumbnail_rounded_corner);
if (rounded) {
drawable.setCornerRadii(new float[]{r, r, r, r, r, r, r, r});
}
return drawable;
}
static Drawable bootstrapAlert(Context context,
BootstrapBrand bootstrapBrand) {
GradientDrawable disabledGd = new GradientDrawable();
int strokeWidth = context.getResources().getDimensionPixelSize(R.dimen.bootstrap_alert_stroke_width);
disabledGd.setColor(ColorUtils.increaseOpacityFromInt(context, bootstrapBrand.getColor(),
40));
disabledGd.setCornerRadius(6);
disabledGd.setStroke(strokeWidth, ColorUtils.increaseOpacityFromInt(context, bootstrapBrand.getColor(), 70));
return disabledGd;
}
/**
* Generates a colorstatelist for a bootstrap button
*
* @param context the current context
* @param outline whether the button is outlined
* @param brand the button brand
* @return the color state list
*/
static ColorStateList bootstrapButtonText(Context context, boolean outline, BootstrapBrand brand) {
int defaultColor = outline ? brand.defaultFill(context) : brand.defaultTextColor(context);
int activeColor = outline ? ColorUtils.resolveColor(android.R.color.white, context) : brand.activeTextColor(context);
int disabledColor = outline ? brand.disabledFill(context) : brand.disabledTextColor(context);
if (outline && brand instanceof DefaultBootstrapBrand) { // special case
DefaultBootstrapBrand db = (DefaultBootstrapBrand) brand;
if (db == DefaultBootstrapBrand.SECONDARY) {
defaultColor = ColorUtils.resolveColor(R.color.bootstrap_brand_secondary_border, context);
disabledColor = defaultColor;
}
}
return new ColorStateList(getStateList(), getColorList(defaultColor, activeColor, disabledColor));
}
static Drawable bootstrapWell(@ColorInt int backgroundColor, int cornerRadius, int strokeWidth, @ColorInt int strokeColor) {
GradientDrawable background = new GradientDrawable();
background.setColor(backgroundColor);
background.setCornerRadius(cornerRadius);
background.setStroke(strokeWidth, strokeColor);
return background;
}
private static StateListDrawable setupStateDrawable(ViewGroupPosition position, int strokeWidth, GradientDrawable defaultGd, GradientDrawable activeGd, GradientDrawable disabledGd) {
StateListDrawable stateListDrawable = new StateListDrawable();
LayerDrawable defaultLayer = new LayerDrawable(new Drawable[]{defaultGd});
LayerDrawable activeLayer = new LayerDrawable(new Drawable[]{activeGd});
LayerDrawable disabledLayer = new LayerDrawable(new Drawable[]{disabledGd});
LayerDrawable[] ldAry = new LayerDrawable[]{defaultLayer, activeLayer, disabledLayer};
int n = strokeWidth * -1;
// use LayerDrawable to hide strokes on one side of the drawable (if needed), using negative insets
if (position != null) {
switch (position) {
case MIDDLE_HORI:
setInsetOnLayers(ldAry, n, 0, 0, 0);
break;
case END:
setInsetOnLayers(ldAry, n, 0, 0, 0);
break;
case MIDDLE_VERT:
setInsetOnLayers(ldAry, 0, n, 0, 0);
break;
case BOTTOM:
setInsetOnLayers(ldAry, 0, n, 0, 0);
}
}
if (Build.VERSION.SDK_INT >= 14) {
stateListDrawable.addState(new int[]{android.R.attr.state_hovered}, activeLayer);
}
stateListDrawable.addState(new int[]{android.R.attr.state_activated}, activeLayer);
stateListDrawable.addState(new int[]{android.R.attr.state_focused}, activeLayer);
stateListDrawable.addState(new int[]{android.R.attr.state_pressed}, activeLayer);
stateListDrawable.addState(new int[]{android.R.attr.state_selected}, activeLayer);
stateListDrawable.addState(new int[]{-android.R.attr.state_enabled}, disabledLayer);
stateListDrawable.addState(new int[]{}, defaultLayer);
return stateListDrawable;
}
private static void setupDrawableCorners(ViewGroupPosition position, boolean rounded, int r,
GradientDrawable defaultGd, GradientDrawable activeGd, GradientDrawable disabledGd) {
if (rounded) {
if (position == ViewGroupPosition.SOLO) {
defaultGd.setCornerRadius(r);
activeGd.setCornerRadius(r);
disabledGd.setCornerRadius(r);
}
else {
float[] radii; // X/Y pairs for top-left, top-right, bottom-right, bottom-left.
switch (position) {
case MIDDLE_HORI:
radii = new float[]{0, 0, 0, 0, 0, 0, 0, 0};
break;
case MIDDLE_VERT:
radii = new float[]{0, 0, 0, 0, 0, 0, 0, 0};
break;
case TOP:
radii = new float[]{r, r, r, r, 0, 0, 0, 0};
break;
case BOTTOM:
radii = new float[]{0, 0, 0, 0, r, r, r, r};
break;
case START:
radii = new float[]{r, r, 0, 0, 0, 0, r, r,};
break;
case END:
radii = new float[]{0, 0, r, r, r, r, 0, 0};
break;
default:
radii = new float[]{0, 0, 0, 0, 0, 0, 0, 0};
break;
}
defaultGd.setCornerRadii(radii);
activeGd.setCornerRadii(radii);
disabledGd.setCornerRadii(radii);
}
}
}
private static int[][] getStateList() {
if (Build.VERSION.SDK_INT >= 14) {
return new int[][]
{new int[]{android.R.attr.state_hovered}, new int[]{android.R.attr.state_activated},
new int[]{android.R.attr.state_focused}, new int[]{android.R.attr.state_selected},
new int[]{android.R.attr.state_pressed}, new int[]{android.R.attr.state_hovered},
new int[]{-android.R.attr.state_enabled}, new int[]{}};
}
else {
return new int[][]
{new int[]{android.R.attr.state_activated}, new int[]{android.R.attr.state_focused},
new int[]{android.R.attr.state_selected}, new int[]{android.R.attr.state_pressed},
new int[]{android.R.attr.state_hovered}, new int[]{-android.R.attr.state_enabled},
new int[]{}};
}
}
private static int[] getColorList(int defaultColor, int activeColor, int disabledColor) {
if (Build.VERSION.SDK_INT >= 14) {
return new int[]{activeColor, activeColor, activeColor, activeColor, activeColor,
activeColor, disabledColor, defaultColor};
}
else {
return new int[]{activeColor, activeColor, activeColor, activeColor, activeColor,
disabledColor, defaultColor};
}
}
static StateListDrawable bootstrapDropDownArrow(Context context, int width, int height, ExpandDirection expandDirection, boolean outline, BootstrapBrand brand) {
StateListDrawable stateListDrawable = new StateListDrawable();
int defaultColor = outline ? brand.defaultFill(context) : brand.defaultTextColor(context);
int activeColor = outline ? ColorUtils.resolveColor(android.R.color.white, context) : brand.activeTextColor(context);
int disabledColor = outline ? brand.disabledFill(context) : brand.disabledTextColor(context);
if (Build.VERSION.SDK_INT >= 14) {
stateListDrawable.addState(new int[]{android.R.attr.state_hovered}, createArrowIcon(context, width, height, activeColor, expandDirection));
}
stateListDrawable.addState(new int[]{android.R.attr.state_activated}, createArrowIcon(context, width, height, activeColor, expandDirection));
stateListDrawable.addState(new int[]{android.R.attr.state_focused}, createArrowIcon(context, width, height, activeColor, expandDirection));
stateListDrawable.addState(new int[]{android.R.attr.state_pressed}, createArrowIcon(context, width, height, activeColor, expandDirection));
stateListDrawable.addState(new int[]{android.R.attr.state_selected}, createArrowIcon(context, width, height, activeColor, expandDirection));
stateListDrawable.addState(new int[]{-android.R.attr.state_enabled}, createArrowIcon(context, width, height, disabledColor, expandDirection));
stateListDrawable.addState(new int[]{}, createArrowIcon(context, width, height, defaultColor, expandDirection));
return stateListDrawable;
}
static StateListDrawable bootstrapAlertCloseIcon(Context context, int width, int height, int inset) {
StateListDrawable stateListDrawable = new StateListDrawable();
int defaultColor = ColorUtils.resolveColor(R.color.bootstrap_alert_cross_default, context);
int activeColor = ColorUtils.resolveColor(R.color.bootstrap_gray, context);
int disabledColor = ColorUtils.resolveColor(R.color.bootstrap_alert_cross_default, context);
if (Build.VERSION.SDK_INT >= 14) {
stateListDrawable.addState(new int[]{android.R.attr.state_hovered}, createCloseCrossIcon(context, width, height, activeColor, inset));
}
stateListDrawable.addState(new int[]{android.R.attr.state_activated}, createCloseCrossIcon(context, width, height, activeColor, inset));
stateListDrawable.addState(new int[]{android.R.attr.state_focused}, createCloseCrossIcon(context, width, height, activeColor, inset));
stateListDrawable.addState(new int[]{android.R.attr.state_pressed}, createCloseCrossIcon(context, width, height, activeColor, inset));
stateListDrawable.addState(new int[]{android.R.attr.state_selected}, createCloseCrossIcon(context, width, height, activeColor, inset));
stateListDrawable.addState(new int[]{-android.R.attr.state_enabled}, createCloseCrossIcon(context, width, height, disabledColor, inset));
stateListDrawable.addState(new int[]{}, createCloseCrossIcon(context, width, height, defaultColor, inset));
return stateListDrawable;
}
/**
* Creates arrow icon that depends on ExpandDirection
*
* @param context context
* @param width width of icon in pixels
* @param height height of icon in pixels
* @param color arrow color
* @param expandDirection arrow direction
* @return icon drawable
*/
private static Drawable createArrowIcon(Context context, int width, int height, int color, ExpandDirection expandDirection) {
Bitmap canvasBitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
Canvas canvas = new Canvas(canvasBitmap);
Paint paint = new Paint();
paint.setStyle(Paint.Style.FILL_AND_STROKE);
paint.setStrokeWidth(1);
paint.setColor(color);
paint.setAntiAlias(true);
Path path = new Path();
path.setFillType(Path.FillType.EVEN_ODD);
switch (expandDirection) {
case UP:
path.moveTo(0, (height / 3) * 2);
path.lineTo(width, (height / 3) * 2);
path.lineTo(width / 2, height / 3);
path.lineTo(0, (height / 3) * 2);
break;
case DOWN:
path.moveTo(0, height / 3);
path.lineTo(width, height / 3);
path.lineTo(width / 2, (height / 3) * 2);
path.lineTo(0, height / 3);
break;
}
path.close();
canvas.drawPath(path, paint);
return new BitmapDrawable(context.getResources(), canvasBitmap);
}
private static Drawable createCloseCrossIcon(Context context, int width, int height, int color, int inset) {
Bitmap canvasBitmap = Bitmap.createBitmap(width + inset * 2, height + inset * 2, Bitmap.Config.ARGB_8888);
Canvas canvas = new Canvas(canvasBitmap);
Paint paint = new Paint();
paint.setStyle(Paint.Style.FILL_AND_STROKE);
paint.setStrokeWidth(3);
paint.setColor(color);
paint.setAntiAlias(true);
Path path = new Path();
path.setFillType(Path.FillType.EVEN_ODD);
path.moveTo(inset, inset);
path.lineTo(width + inset, height + inset);
path.moveTo(width + inset, inset);
path.lineTo(inset, height + inset);
path.close();
canvas.drawPath(path, paint);
return new BitmapDrawable(context.getResources(), canvasBitmap);
}
public static Drawable createBadgeDrawable(Context context, BootstrapBrand brand, int width,
int height, String badgeText, boolean insideAnObject) {
if (badgeText == null) {
return null;
}
else {
Paint badgePaint = new Paint();
Rect canvasBounds = new Rect();
TextPaint badgeTextPaint = new TextPaint();
badgePaint.setFlags(Paint.ANTI_ALIAS_FLAG);
badgeTextPaint.setFlags(Paint.ANTI_ALIAS_FLAG);
badgeTextPaint.setTextAlign(Paint.Align.CENTER);
badgeTextPaint.setTextSize((float) (height * 0.7));
if (insideAnObject) {
badgePaint.setColor(brand.defaultTextColor(context));
badgeTextPaint.setColor(brand.defaultFill(context));
}
else {
badgePaint.setColor(brand.defaultFill(context));
badgeTextPaint.setColor(brand.defaultTextColor(context));
}
int rectLength = (int) badgeTextPaint.measureText(badgeText);
Bitmap canvasBitmap = Bitmap.createBitmap(width + rectLength, height, Bitmap.Config.ARGB_8888);
Canvas canvas = new Canvas(canvasBitmap);
canvas.getClipBounds(canvasBounds);
int firstCircleDx = canvasBounds.left + canvasBounds.height() / 2;
int circleDy = canvasBounds.height() / 2;
int circleRadius = canvasBounds.height() / 2;
int secondCircleDx = firstCircleDx + rectLength;
Rect rect = new Rect();
rect.left = firstCircleDx;
rect.top = 0;
rect.right = rect.left + rectLength;
rect.bottom = canvasBounds.height();
canvas.drawCircle(firstCircleDx, circleDy, circleRadius, badgePaint);
canvas.drawRect(rect, badgePaint);
canvas.drawCircle(secondCircleDx, circleDy, circleRadius, badgePaint);
canvas.drawText(badgeText, canvasBounds.width() / 2, canvasBounds.height() / 2 - ((badgeTextPaint.descent() +
badgeTextPaint.ascent()) / 2),
badgeTextPaint);
return new BitmapDrawable(context.getResources(), canvasBitmap);
}
}
static ColorStateList bootstrapDropDownViewText(Context context) {
int defaultColor = ColorUtils.resolveColor(R.color.bootstrap_gray_dark, context);
int activeColor = ColorUtils.resolveColor(android.R.color.black, context);
int disabledColor = ColorUtils.resolveColor(R.color.bootstrap_gray_light, context);
return new ColorStateList(getStateList(), getColorList(defaultColor, activeColor, disabledColor));
}
private static void setInsetOnLayers(LayerDrawable[] ary, int l, int t, int r, int b) {
for (LayerDrawable ld : ary) {
ld.setLayerInset(0, l, t, r, b);
}
}
}
================================================
FILE: AndroidBootstrap/src/main/java/com/beardedhen/androidbootstrap/BootstrapDropDown.java
================================================
package com.beardedhen.androidbootstrap;
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.os.Parcelable;
import android.support.v4.widget.PopupWindowCompat;
import android.util.AttributeSet;
import android.util.DisplayMetrics;
import android.view.Gravity;
import android.view.View;
import android.view.ViewGroup;
import android.view.WindowManager;
import android.widget.LinearLayout;
import android.widget.LinearLayout.LayoutParams;
import android.widget.PopupWindow;
import android.widget.ScrollView;
import android.widget.TextView;
import com.beardedhen.androidbootstrap.api.attributes.BootstrapBrand;
import com.beardedhen.androidbootstrap.api.attributes.ViewGroupPosition;
import com.beardedhen.androidbootstrap.api.defaults.DefaultBootstrapSize;
import com.beardedhen.androidbootstrap.api.defaults.ExpandDirection;
import com.beardedhen.androidbootstrap.api.view.BootstrapSizeView;
import com.beardedhen.androidbootstrap.api.view.OutlineableView;
import com.beardedhen.androidbootstrap.api.view.RoundableView;
import com.beardedhen.androidbootstrap.utils.ColorUtils;
import com.beardedhen.androidbootstrap.utils.DimenUtils;
import com.beardedhen.androidbootstrap.utils.DrawableUtils;
import com.beardedhen.androidbootstrap.utils.ViewUtils;
import java.io.Serializable;
import java.util.regex.Pattern;
/**
* BootstrapButtons are buttons which provide contextual menus, styled with BootstrapBrand colors,
* roundable corners, and an 'outlineable' mode.
*/
@BetaApi
public class BootstrapDropDown extends AwesomeTextView implements View.OnClickListener, RoundableView, OutlineableView, PopupWindow.OnDismissListener {
private static final String TAG = "com.beardedhen.androidbootstrap.BootstrapDropDown";
private static final String KEY_DIRECTION = "com.beardedhen.androidbootstrap.BootstrapDropDown.EXPAND_DIRECTION";
private static final String SEARCH_REGEX_HEADER = "\\{dropdown_header\\}.*";
private static final String SEARCH_REGEX_SEPARATOR = "\\{dropdown_separator\\}.*";
private static final String SEARCH_REGEX_DISABLED = "\\{dropdown_disabled\\}.*";
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;
private View.OnClickListener clickListener;
private String[] dropdownData;
private OnDropDownItemClickListener onDropDownItemClickListener;
private boolean roundedCorners;
private boolean showOutline;
private float bootstrapSize;
private int itemHeight;
private int dropDownViewHeight;
private int dropDownViewWidth;
private int screenWidth;
private float baselineStrokeWidth;
private float baselineCornerRadius;
private float baselineFontSize;
private float baselineDropDownViewFontSize;
private float baselineItemRightPadding;
private float baselineItemLeftPadding;
private float baselineVertPadding;
private float baselineHoriPadding;
public BootstrapDropDown(Context context) {
super(context);
initialise(null);
}
public BootstrapDropDown(Context context, AttributeSet attrs) {
super(context, attrs);
initialise(attrs);
}
public BootstrapDropDown(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
initialise(attrs);
}
private void initialise(AttributeSet attrs) {
TypedArray a = getContext().obtainStyledAttributes(attrs, R.styleable.BootstrapDropDown);
try {
this.roundedCorners = a.getBoolean(R.styleable.BootstrapDropDown_roundedCorners, false);
this.showOutline = a.getBoolean(R.styleable.BootstrapDropDown_showOutline, false);
int directionOrdinal = a.getInt(R.styleable.BootstrapDropDown_bootstrapExpandDirection, -1);
int dataOrdinal = a.getResourceId(R.styleable.BootstrapDropDown_dropdownResource, -1);
int sizeOrdinal = a.getInt(R.styleable.BootstrapDropDown_bootstrapSize, -1);
expandDirection = ExpandDirection.fromAttributeValue(directionOrdinal);
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();
}
baselineStrokeWidth = DimenUtils.pixelsFromDpResource(getContext(), R.dimen.bootstrap_dropdown_default_edge_width);
baselineCornerRadius = DimenUtils.pixelsFromDpResource(getContext(), R.dimen.bootstrap_dropdown_default_corner_radius);
baselineFontSize = DimenUtils.pixelsFromSpResource(getContext(), R.dimen.bootstrap_dropdown_default_font_size);
baselineDropDownViewFontSize = DimenUtils.pixelsFromSpResource(getContext(), R.dimen.bootstrap_dropdown_default_item_font_size);
baselineItemLeftPadding = DimenUtils.pixelsFromDpResource(getContext(), R.dimen.bootstrap_dropdown_default_item_left_padding);
baselineItemRightPadding = DimenUtils.pixelsFromDpResource(getContext(), R.dimen.bootstrap_dropdown_default_item_right_padding);
baselineVertPadding = DimenUtils.pixelsFromDpResource(getContext(), R.dimen.bootstrap_button_default_vert_padding);
baselineHoriPadding = DimenUtils.pixelsFromDpResource(getContext(), R.dimen.bootstrap_button_default_hori_padding);
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();
}
private void createDropDown() {
ScrollView dropdownView = createDropDownView();
dropdownWindow = new PopupWindow();
dropdownWindow.setFocusable(true);
dropdownWindow.setHeight(WindowManager.LayoutParams.WRAP_CONTENT);
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);
float longestStringWidth = measureStringWidth(getLongestString(dropdownData))
+ DimenUtils.dpToPixels((baselineItemRightPadding + baselineItemLeftPadding) * bootstrapSize);
if (longestStringWidth < getMeasuredWidth()) {
dropdownWindow.setWidth(DimenUtils.dpToPixels(getMeasuredWidth()));
}
else {
dropdownWindow.setWidth((int) longestStringWidth + DimenUtils.dpToPixels(8));
}
}
private ScrollView createDropDownView() {
final LinearLayout dropdownView = new LinearLayout(getContext());
ScrollView scrollView = new ScrollView(getContext());
int clickableChildCounter = 0;
dropdownView.setOrientation(LinearLayout.VERTICAL);
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);
int padding = (int) (baselineItemLeftPadding * bootstrapSize);
childView.setPadding(padding, 0, padding, 0);
childView.setTextSize(baselineDropDownViewFontSize * bootstrapSize);
childView.setTextColor(ColorUtils.resolveColor(android.R.color.black, getContext()));
Drawable background = getContext().obtainStyledAttributes(null, new int[]{
android.R.attr.selectableItemBackground}, 0, 0)
.getDrawable(0);
ViewUtils.setBackgroundDrawable(childView, background);
childView.setTextColor(BootstrapDrawableFactory.bootstrapDropDownViewText(getContext()));
childView.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
dropdownWindow.dismiss();
if (onDropDownItemClickListener != null) {
onDropDownItemClickListener.onItemClick(dropdownView, v, v.getId());
}
}
});
if (Pattern.matches(SEARCH_REGEX_HEADER, text)) {
childView.setText(text.replaceFirst(REPLACE_REGEX_HEADER, ""));
childView.setTextSize((baselineDropDownViewFontSize - 2F) * bootstrapSize);
childView.setClickable(false);
childView.setTextColor(ColorUtils.resolveColor(R.color.bootstrap_gray_light,
getContext()));
}
else if (Pattern.matches(SEARCH_REGEX_SEPARATOR, text)) {
childView = new DividerView(getContext());
childView.setClickable(false);
childView.setLayoutParams(new LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, 3));
}
else if (Pattern.matches(SEARCH_REGEX_DISABLED, text)) {
childView.setEnabled(false);
childView.setId(clickableChildCounter++);
childView.setText(text.replaceFirst(REPLACE_REGEX_DISABLED, ""));
}
else {
childView.setText(text);
childView.setId(clickableChildCounter++);
}
dropdownView.addView(childView);
}
dropdownView.measure(MeasureSpec.UNSPECIFIED, MeasureSpec.UNSPECIFIED);
dropDownViewHeight = dropdownView.getMeasuredHeight();
dropDownViewWidth = dropdownView.getMeasuredWidth();
scrollView.setVerticalScrollBarEnabled(false);
scrollView.setHorizontalScrollBarEnabled(false);
scrollView.addView(dropdownView);
cleanData();
return scrollView;
}
private void updateDropDownState() {
super.updateBootstrapState();
BootstrapBrand bootstrapBrand = getBootstrapBrand();
float cornerRadius = baselineCornerRadius;
float strokeWidth = baselineStrokeWidth;
final float fontSize = baselineFontSize * bootstrapSize;
strokeWidth *= bootstrapSize;
super.setOnClickListener(this);
setTextSize(fontSize);
setGravity(Gravity.CENTER);
setCompoundDrawablesWithIntrinsicBounds(null, null,
BootstrapDrawableFactory.bootstrapDropDownArrow(getContext(),
DimenUtils.dpToPixels(8 * bootstrapSize),
DimenUtils.dpToPixels(12 * bootstrapSize),
expandDirection,
showOutline,
getBootstrapBrand())
, null);
setCompoundDrawablePadding(DimenUtils.dpToPixels(8));
setTextColor(BootstrapDrawableFactory.bootstrapButtonText(
getContext(),
showOutline,
bootstrapBrand));
Drawable bg = BootstrapDrawableFactory.bootstrapButton(getContext(),
bootstrapBrand,
(int) strokeWidth,
(int) cornerRadius,
ViewGroupPosition.SOLO,
showOutline,
roundedCorners);
ViewUtils.setBackgroundDrawable(this, bg);
int vert = (int) (baselineVertPadding * bootstrapSize);
int hori = (int) (baselineHoriPadding * bootstrapSize);
setPadding(hori, vert, hori, vert);
}
/**
* Calculating string width
*
* @param text String to calculate
* @return width of String in pixels
*/
private float measureStringWidth(String text) {
Paint mPaint = new Paint();
mPaint.setTextSize(baselineDropDownViewFontSize * bootstrapSize);
return (float) (DimenUtils.dpToPixels(mPaint.measureText(text)));
}
/**
* Searching for longest string in array
*
* @param array input string array
* @return longest string
*/
private String getLongestString(String[] array) {
int maxLength = 0;
String longestString = null;
for (String s : array) {
if (s.length() > maxLength) {
maxLength = s.length();
longestString = s;
}
}
return longestString;
}
private void cleanData() {
String[] cleanArray = new String[dropdownData.length];
for (int i = 0; i < dropdownData.length; i++) {
cleanArray[i] = dropdownData[i].replaceAll(REPLACE_REGEX_HEADER, "")
.replaceAll(REPLACE_REGEX_DISABLED, "")
.replaceAll(REPLACE_REGEX_SEPARATOR, "");
}
dropdownData = cleanArray;
}
/**
* Sets a listener which will be called when an item is clicked in the dropdown.
*
* @param onDropDownItemClickListener the listener
*/
public void setOnDropDownItemClickListener(OnDropDownItemClickListener onDropDownItemClickListener) {
this.onDropDownItemClickListener = onDropDownItemClickListener;
}
@Override public boolean isShowOutline() {
return showOutline;
}
@Override public boolean isRounded() {
return roundedCorners;
}
/**
* Gets the direction in which the dropdown expands.
*
* @return the direction
*/
public ExpandDirection getExpandDirection() {
return expandDirection;
}
/**
* Retrieves the data used to populate the dropdown.
*
* @return a string array of values
*/
public String[] getDropdownData() {
return dropdownData;
}
@Override public void setShowOutline(boolean showOutline) {
this.showOutline = showOutline;
updateDropDownState();
}
@Override public void setRounded(boolean rounded) {
this.roundedCorners = rounded;
updateDropDownState();
}
/**
* Sets the direction in which the dropdown should expand.
*
* @param expandDirection the direction
*/
public void setExpandDirection(ExpandDirection expandDirection) {
this.expandDirection = expandDirection;
updateDropDownState();
}
/**
* Sets the String values which should be used to populate the menu displayed in the dropdown.
*
* @param dropdownData an array of string values.
*/
public void setDropdownData(String[] dropdownData) {
this.dropdownData = dropdownData;
createDropDown();
updateDropDownState();
}
@Override public void onDismiss() {
setSelected(false);
dropdownWindow.getContentView().scrollTo(0, 0);
}
@Override public void onClick(View v) {
if (clickListener != null) {
clickListener.onClick(v);
}
//using 8dip on axisX offset to make dropdown view visually be at start of dropdown itself
//using 4dip on axisY offset to make space between dropdown view and dropdown itself
//all offsets are necessary because of the dialog_holo_light_frame to display correctly on screen(shadow was made by inset)
int gravity;
int axisXOffset;
if (dropDownViewWidth + getX() > screenWidth) {
gravity = Gravity.TOP | Gravity.END;
axisXOffset = DimenUtils.dpToPixels(8);
}
else {
gravity = Gravity.TOP | Gravity.START;
axisXOffset = -DimenUtils.dpToPixels(8);
}
int axisYOffset = DimenUtils.dpToPixels(4);
switch (expandDirection) {
case UP:
PopupWindowCompat.showAsDropDown(dropdownWindow, v,
axisXOffset,
-dropDownViewHeight - getMeasuredHeight() - axisYOffset * 3,
gravity);
break;
case DOWN:
PopupWindowCompat.showAsDropDown(dropdownWindow, v,
axisXOffset,
-axisYOffset,
gravity);
break;
}
setSelected(true);
}
@Override public Parcelable onSaveInstanceState() {
Bundle bundle = new Bundle();
bundle.putParcelable(TAG, super.onSaveInstanceState());
bundle.putBoolean(RoundableView.KEY, roundedCorners);
bundle.putBoolean(OutlineableView.KEY, showOutline);
bundle.putSerializable(KEY_DIRECTION, expandDirection);
bundle.putFloat(BootstrapSizeView.KEY, bootstrapSize);
return bundle;
}
@Override public void onRestoreInstanceState(Parcelable state) {
if (state instanceof Bundle) {
Bundle bundle = (Bundle) state;
this.roundedCorners = bundle.getBoolean(RoundableView.KEY);
this.showOutline = bundle.getBoolean(OutlineableView.KEY);
this.bootstrapSize = bundle.getFloat(BootstrapSizeView.KEY);
Serializable direction = bundle.getSerializable(KEY_DIRECTION);
if (direction instanceof ExpandDirection) {
expandDirection = (ExpandDirection) direction;
}
}
super.onRestoreInstanceState(state);
}
@Override public void setOnClickListener(OnClickListener clickListener) {
this.clickListener = clickListener;
}
/**
* A listener which provides methods relating to {@link BootstrapDropDown}
*/
public interface OnDropDownItemClickListener {
/**
* Called when an item is clicked in a {@link BootstrapDropDown}
*
* @param parent the parent viewgroup
* @param v the view
* @param id the id
*/
void onItemClick(ViewGroup parent, View v, int id);
}
private static class DividerView extends TextView {
private final Paint paint;
public DividerView(Context context) {
super(context);
paint = new Paint();
paint.setColor(ColorUtils.resolveColor(R.color.bootstrap_dropdown_divider, context));
}
@Override protected void onDraw(Canvas canvas) {
canvas.drawLine(0, 1, canvas.getWidth(), 1, paint);
super.onDraw(canvas);
}
}
}
================================================
FILE: AndroidBootstrap/src/main/java/com/beardedhen/androidbootstrap/BootstrapEditText.java
================================================
package com.beardedhen.androidbootstrap;
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.os.Parcelable;
import android.support.annotation.NonNull;
import android.util.AttributeSet;
import android.view.Gravity;
import android.widget.EditText;
import com.beardedhen.androidbootstrap.api.attributes.BootstrapBrand;
import com.beardedhen.androidbootstrap.api.defaults.DefaultBootstrapBrand;
import com.beardedhen.androidbootstrap.api.defaults.DefaultBootstrapSize;
import com.beardedhen.androidbootstrap.api.view.BootstrapBrandView;
import com.beardedhen.androidbootstrap.api.view.BootstrapSizeView;
import com.beardedhen.androidbootstrap.api.view.RoundableView;
import com.beardedhen.androidbootstrap.utils.DimenUtils;
import com.beardedhen.androidbootstrap.utils.ViewUtils;
import java.io.Serializable;
/**
* BootstrapEditText allows users to enter values like a regular Android EditText, and allows coloring
* via BootstrapBrand, and rounding of its background.
*/
public class BootstrapEditText extends EditText implements BootstrapBrandView, RoundableView,
BootstrapSizeView {
private static final String TAG = "com.beardedhen.androidbootstrap.BootstrapEditText";
private float baselineFontSize;
private float baselineVertPadding;
private float baselineHoriPadding;
private float baselineStrokeWidth;
private float baselineCornerRadius;
private BootstrapBrand bootstrapBrand;
private float bootstrapSize;
private boolean rounded;
public BootstrapEditText(Context context) {
super(context);
initialise(null);
}
public BootstrapEditText(Context context, AttributeSet attrs) {
super(context, attrs);
initialise(attrs);
}
public BootstrapEditText(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
initialise(attrs);
}
private void initialise(AttributeSet attrs) {
TypedArray a = getContext().obtainStyledAttributes(attrs, R.styleable.BootstrapEditText);
try {
this.rounded = a.getBoolean(R.styleable.BootstrapEditText_roundedCorners, false);
int typeOrdinal = a.getInt(R.styleable.BootstrapEditText_bootstrapBrand, -1);
int sizeOrdinal = a.getInt(R.styleable.BootstrapEditText_bootstrapSize, -1);
this.bootstrapBrand = DefaultBootstrapBrand.fromAttributeValue(typeOrdinal);
this.bootstrapSize = DefaultBootstrapSize.fromAttributeValue(sizeOrdinal).scaleFactor();
}
finally {
a.recycle();
}
baselineFontSize = DimenUtils.pixelsFromSpResource(getContext(), R.dimen.bootstrap_edit_text_default_font_size);
baselineVertPadding = DimenUtils.pixelsFromDpResource(getContext(), R.dimen.bootstrap_edit_text_vert_padding);
baselineHoriPadding = DimenUtils.pixelsFromDpResource(getContext(), R.dimen.bootstrap_edit_text_hori_padding);
baselineStrokeWidth = DimenUtils.pixelsFromDpResource(getContext(), R.dimen.bootstrap_edit_text_edge_width);
baselineCornerRadius = DimenUtils.pixelsFromDpResource(getContext(), R.dimen.bootstrap_edit_text_corner_radius);
a = getContext().obtainStyledAttributes(attrs, new int[] {android.R.attr.gravity});
try {
setGravity(a.getInt(0, Gravity.CENTER_VERTICAL)); // center text vertically by default
} finally {
a.recycle();
}
updateBootstrapState();
invalidate();
}
@Override public Parcelable onSaveInstanceState() {
Bundle bundle = new Bundle();
bundle.putParcelable(TAG, super.onSaveInstanceState());
bundle.putBoolean(RoundableView.KEY, rounded);
bundle.putFloat(BootstrapSizeView.KEY, bootstrapSize);
bundle.putSerializable(BootstrapBrand.KEY, bootstrapBrand);
return bundle;
}
@Override public void onRestoreInstanceState(Parcelable state) {
if (state instanceof Bundle) {
Bundle bundle = (Bundle) state;
this.rounded = bundle.getBoolean(RoundableView.KEY);
this.bootstrapSize = bundle.getFloat(BootstrapSizeView.KEY);
Serializable brand = bundle.getSerializable(BootstrapBrand.KEY);
if (brand instanceof BootstrapBrand) {
bootstrapBrand = (BootstrapBrand) brand;
}
state = bundle.getParcelable(TAG);
}
super.onRestoreInstanceState(state);
updateBootstrapState();
}
private void updateBootstrapState() {
int vPadding = (int) (baselineVertPadding * bootstrapSize);
int hPadding = (int) (baselineHoriPadding * bootstrapSize);
setPadding(vPadding, hPadding, vPadding, hPadding);
int strokeWidth = (int) (baselineStrokeWidth * bootstrapSize);
float cornerRadius = baselineCornerRadius * bootstrapSize;
final float fontSize = baselineFontSize * bootstrapSize;
setTextSize(fontSize);
Drawable bg = BootstrapDrawableFactory.bootstrapEditText(
getContext(),
bootstrapBrand,
strokeWidth,
cornerRadius,
rounded);
ViewUtils.setBackgroundDrawable(this, bg);
}
/*
* Getters/Setters
*/
@Override public void setBootstrapBrand(@NonNull BootstrapBrand bootstrapBrand) {
this.bootstrapBrand = bootstrapBrand;
updateBootstrapState();
}
@NonNull @Override public BootstrapBrand getBootstrapBrand() {
return bootstrapBrand;
}
@Override public void setRounded(boolean rounded) {
this.rounded = rounded;
updateBootstrapState();
}
@Override public boolean isRounded() {
return rounded;
}
@Override public float getBootstrapSize() {
return bootstrapSize;
}
@Override public void setBootstrapSize(float bootstrapSize) {
this.bootstrapSize = bootstrapSize;
updateBootstrapState();
}
@Override public void setBootstrapSize(DefaultBootstrapSize bootstrapSize) {
setBootstrapSize(bootstrapSize.scaleFactor());
}
}
================================================
FILE: AndroidBootstrap/src/main/java/com/beardedhen/androidbootstrap/BootstrapGroup.java
================================================
package com.beardedhen.androidbootstrap;
import android.content.Context;
import android.support.annotation.NonNull;
import android.util.AttributeSet;
import android.view.View;
import android.view.ViewGroup;
import android.widget.LinearLayout;
/**
* This is a base class that provies methods to get updates when a view is removed or added or rotated and contains abstract methods for the set up of the class.
* @see BootstrapProgressBarGroup
* @see BootstrapButtonGroup
*/
abstract class BootstrapGroup extends LinearLayout {
public BootstrapGroup(Context context) {
super(context);
initialise(null);
}
public BootstrapGroup(Context context, AttributeSet attrs) {
super(context, attrs);
initialise(attrs);
}
public BootstrapGroup(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
initialise(attrs);
}
protected abstract void initialise(AttributeSet attrs);
@Override public void setOrientation(int orientation) {
super.setOrientation(orientation);
updateBootstrapGroup();
}
protected abstract void updateBootstrapGroup();
protected abstract void onBootstrapViewAdded();
protected abstract void onBootstrapViewRemoved();
@Override
public void addView(View child, int index, ViewGroup.LayoutParams params) {
super.addView(child, index, params);
onBootstrapViewAdded();
}
@Override
public void removeAllViews() {
super.removeAllViews();
onBootstrapViewRemoved();
}
@Override
public void removeView(View view) {
super.removeView(view);
onBootstrapViewRemoved();
}
@Override
public void removeViewInLayout(View view) {
super.removeViewInLayout(view);
onBootstrapViewRemoved();
}
@Override
public void removeViewsInLayout(int start, int count) {
super.removeViewsInLayout(start, count);
onBootstrapViewRemoved();
}
@Override
public void removeViewAt(int index) {
View child = getChildAt(index);
super.removeViewAt(index);
onBootstrapViewRemoved();
}
@Override
public void removeViews(int start, int count) {
super.removeViews(start, count);
onBootstrapViewRemoved();
}
}
================================================
FILE: AndroidBootstrap/src/main/java/com/beardedhen/androidbootstrap/BootstrapLabel.java
================================================
package com.beardedhen.androidbootstrap;
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Typeface;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.os.Parcelable;
import android.support.annotation.NonNull;
import android.util.AttributeSet;
import com.beardedhen.androidbootstrap.api.attributes.BootstrapHeading;
import com.beardedhen.androidbootstrap.api.defaults.DefaultBootstrapHeading;
import com.beardedhen.androidbootstrap.api.view.BootstrapHeadingView;
import com.beardedhen.androidbootstrap.api.view.RoundableView;
import com.beardedhen.androidbootstrap.utils.ViewUtils;
import java.io.Serializable;
/**
* BootstrapLabels are designed for showing text styled with BootstrapBrands - they should be
* considered similar to a BootstrapButton, but without the press functionality. It is possible to
* set the size of BootstrapLabels using H1-H6 elements.
*/
public class BootstrapLabel extends AwesomeTextView implements RoundableView, BootstrapHeadingView {
private static final String TAG = "com.beardedhen.androidbootstrap.BootstrapLabel";
private BootstrapHeading bootstrapHeading;
private boolean roundable;
public BootstrapLabel(Context context) {
super(context);
initialise(null);
}
public BootstrapLabel(Context context, AttributeSet attrs) {
super(context, attrs);
initialise(attrs);
}
public BootstrapLabel(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
initialise(attrs);
}
private void initialise(AttributeSet attrs) {
TypedArray a = getContext().obtainStyledAttributes(attrs, R.styleable.BootstrapLabel);
try {
int attrValue = a.getInt(R.styleable.BootstrapLabel_bootstrapHeading, 5);
this.roundable = a.getBoolean(R.styleable.BootstrapLabel_roundedCorners, false);
this.bootstrapHeading = DefaultBootstrapHeading.fromAttributeValue(attrValue);
}
finally {
a.recycle();
}
updateBootstrapState();
}
@Override public Parcelable onSaveInstanceState() {
Bundle bundle = new Bundle();
bundle.putParcelable(TAG, super.onSaveInstanceState());
bundle.putBoolean(RoundableView.KEY, roundable);
bundle.putSerializable(BootstrapHeading.KEY, bootstrapHeading);
return bundle;
}
@Override public void onRestoreInstanceState(Parcelable state) {
if (state instanceof Bundle) {
Bundle bundle = (Bundle) state;
this.roundable = bundle.getBoolean(RoundableView.KEY);
Serializable heading = bundle.getSerializable(BootstrapHeading.KEY);
if (heading instanceof BootstrapHeading) {
bootstrapHeading = (BootstrapHeading) heading;
}
state = bundle.getParcelable(TAG);
}
super.onRestoreInstanceState(state);
updateBootstrapState();
}
@Override public void updateBootstrapState() {
super.updateBootstrapState();
// set bg color etc
if (bootstrapHeading != null) {
int vert = (int) bootstrapHeading.verticalPadding(getContext());
int hori = (int) bootstrapHeading.horizontalPadding(getContext());
setPadding(hori, vert, hori, vert);
setTextSize(bootstrapHeading.getTextSize(getContext()));
}
setTextColor(getBootstrapBrand().defaultTextColor(getContext()));
setTypeface(Typeface.DEFAULT_BOLD);
Drawable bg = BootstrapDrawableFactory.bootstrapLabel(
getContext(),
getBootstrapBrand(),
roundable,
getHeight());
ViewUtils.setBackgroundDrawable(this, bg);
}
@Override protected void onSizeChanged(int w, int h, int oldw, int oldh) {
super.onSizeChanged(w, h, oldw, oldh);
if (roundable && h != oldh) { // corner radius should always be h/2
updateBootstrapState();
}
}
/*
* Getters/Setters
*/
@Override public void setRounded(boolean rounded) {
this.roundable = rounded;
updateBootstrapState();
}
@Override public boolean isRounded() {
return roundable;
}
@Override public void setBootstrapHeading(@NonNull BootstrapHeading bootstrapHeading) {
this.bootstrapHeading = bootstrapHeading;
updateBootstrapState();
}
@NonNull @Override public BootstrapHeading getBootstrapHeading() {
return bootstrapHeading;
}
}
================================================
FILE: AndroidBootstrap/src/main/java/com/beardedhen/androidbootstrap/BootstrapProgressBar.java
================================================
package com.beardedhen.androidbootstrap;
import android.animation.Animator;
import android.animation.ValueAnimator;
import android.annotation.SuppressLint;
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Path;
import android.graphics.PorterDuff;
import android.graphics.PorterDuffXfermode;
import android.graphics.Rect;
import android.graphics.RectF;
import android.os.Bundle;
import android.os.Parcelable;
import android.support.annotation.ColorInt;
import android.support.annotation.NonNull;
import android.util.AttributeSet;
import android.view.View;
import android.view.ViewParent;
import android.view.animation.DecelerateInterpolator;
import android.view.animation.LinearInterpolator;
import com.beardedhen.androidbootstrap.api.attributes.BootstrapBrand;
import com.beardedhen.androidbootstrap.api.defaults.DefaultBootstrapBrand;
import com.beardedhen.androidbootstrap.api.defaults.DefaultBootstrapSize;
import com.beardedhen.androidbootstrap.api.view.BootstrapBrandView;
import com.beardedhen.androidbootstrap.api.view.BootstrapSizeView;
import com.beardedhen.androidbootstrap.api.view.ProgressView;
import com.beardedhen.androidbootstrap.api.view.RoundableView;
import com.beardedhen.androidbootstrap.utils.ColorUtils;
import com.beardedhen.androidbootstrap.utils.DimenUtils;
import java.io.Serializable;
import static android.graphics.Bitmap.Config.ARGB_8888;
/**
* BootstrapProgressBar displays determinate progress to the user, and is colored with BootstrapBrands.
* Striped effects and progress update animations are supported out of the box.
*
* Its possible to group multiple together in an {@link com.beardedhen.androidbootstrap.BootstrapProgressBarGroup BootstrapProgressBarGroup} to give the appearance of a <a href="http://getbootstrap.com/components/#progress-stacked">stacked</a> progressbar.
*/
public class BootstrapProgressBar extends View implements ProgressView, BootstrapBrandView,
RoundableView, BootstrapSizeView, Animator.AnimatorListener, ValueAnimator.AnimatorUpdateListener {
private static final String TAG = "com.beardedhen.androidbootstrap.AwesomeTextView";
private static final long UPDATE_ANIM_MS = 300;
private static final int STRIPE_ALPHA = 150;
private static final long STRIPE_CYCLE_MS = 1500;
private Paint progressPaint;
private Paint stripePaint;
private Paint bgPaint;
private Paint textPaint;
private int userProgress;
private int drawnProgress;
private int maxProgress;
private boolean striped;
private boolean animated;
private boolean rounded;
//used for progressbarGroup so that only the currect corners will be rounded
private boolean canRoundLeft = true;
private boolean canRoundRight = true;
private ValueAnimator progressAnimator;
private Paint tilePaint;
private final float baselineHeight = DimenUtils.pixelsFromDpResource(getContext(), R.dimen.bootstrap_progress_bar_height);
private BootstrapBrand bootstrapBrand;
private Canvas progressCanvas;
private Bitmap progressBitmap;
private Bitmap stripeTile;
private float bootstrapSize;
private boolean showPercentage;
public BootstrapProgressBar(Context context) {
super(context);
initialise(null);
}
public BootstrapProgressBar(Context context, AttributeSet attrs) {
super(context, attrs);
initialise(attrs);
}
public BootstrapProgressBar(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
initialise(attrs);
}
private void initialise(AttributeSet attrs) {
ValueAnimator.setFrameDelay(15); // attempt 60fps
tilePaint = new Paint();
progressPaint = new Paint();
progressPaint.setStyle(Paint.Style.FILL);
progressPaint.setAntiAlias(true);
stripePaint = new Paint();
stripePaint.setStyle(Paint.Style.FILL);
stripePaint.setAntiAlias(true);
textPaint = new Paint();
textPaint.setStyle(Paint.Style.FILL);
textPaint.setAntiAlias(true);
textPaint.setColor(ColorUtils.resolveColor(android.R.color.black, getContext()));
textPaint.setTextSize(DimenUtils.pixelsFromSpResource(getContext(), R.dimen.bootstrap_progress_bar_default_font_size));
bgPaint = new Paint();
bgPaint.setStyle(Paint.Style.FILL);
bgPaint.setColor(ColorUtils.resolveColor(R.color.bootstrap_gray_light, getContext()));
// get attributes
TypedArray a = getContext().obtainStyledAttributes(attrs, R.styleable.BootstrapProgressBar);
try {
this.animated = a.getBoolean(R.styleable.BootstrapProgressBar_animated, false);
this.rounded = a.getBoolean(R.styleable.BootstrapProgressBar_roundedCorners, false);
this.striped = a.getBoolean(R.styleable.BootstrapProgressBar_striped, false);
this.showPercentage = a.getBoolean(R.styleable.BootstrapProgressBar_bootstrapshowPercentage, false);
this.userProgress = a.getInt(R.styleable.BootstrapProgressBar_bootstrapProgress, 0);
this.maxProgress = a.getInt(R.styleable.BootstrapProgressBar_bootstrapMaxProgress, 100);
int typeOrdinal = a.getInt(R.styleable.BootstrapProgressBar_bootstrapBrand, -1);
int sizeOrdinal = a.getInt(R.styleable.BootstrapProgressBar_bootstrapSize, -1);
this.bootstrapSize = DefaultBootstrapSize.fromAttributeValue(sizeOrdinal).scaleFactor();
this.bootstrapBrand = DefaultBootstrapBrand.fromAttributeValue(typeOrdinal);
this.drawnProgress = userProgress;
} finally {
a.recycle();
}
textPaint.setColor(bootstrapBrand.defaultTextColor(getContext()));
textPaint.setTextSize((DimenUtils.pixelsFromSpResource(getContext(), R.dimen.bootstrap_button_default_font_size)) * this.bootstrapSize );
updateBootstrapState();
setProgress(this.userProgress);
setMaxProgress(this.maxProgress);
}
@Override
public Parcelable onSaveInstanceState() {
Bundle bundle = new Bundle();
bundle.putParcelable(TAG, super.onSaveInstanceState());
bundle.putInt(KEY_USER_PROGRESS, userProgress);
bundle.putInt(KEY_DRAWN_PROGRESS, drawnProgress);
bundle.putBoolean(KEY_STRIPED, striped);
bundle.putBoolean(KEY_ANIMATED, animated);
bundle.putBoolean(RoundableView.KEY, rounded);
bundle.putFloat(BootstrapSizeView.KEY, bootstrapSize);
bundle.putSerializable(BootstrapBrand.KEY, bootstrapBrand);
return bundle;
}
@Override
public void onRestoreInstanceState(Parcelable state) {
if (state instanceof Bundle) {
Bundle bundle = (Bundle) state;
Serializable brand = bundle.getSerializable(BootstrapBrand.KEY);
if (brand instanceof BootstrapBrand) {
bootstrapBrand = (BootstrapBrand) brand;
}
this.userProgress = bundle.getInt(KEY_USER_PROGRESS);
this.drawnProgress = bundle.getInt(KEY_DRAWN_PROGRESS);
this.striped = bundle.getBoolean(KEY_STRIPED);
this.animated = bundle.getBoolean(KEY_ANIMATED);
this.rounded = bundle.getBoolean(RoundableView.KEY);
this.bootstrapSize = bundle.getFloat(BootstrapSizeView.KEY);
state = bundle.getParcelable(TAG);
}
super.onRestoreInstanceState(state);
updateBootstrapState();
setProgress(userProgress);
}
private int getStripeColor(@ColorInt int color) {
return Color.argb(STRIPE_ALPHA, Color.red(color), Color.green(color), Color.blue(color));
}
/**
* Starts an animation which moves the progress bar from one value to another, in response to
* a call to setProgress(). Animation update callbacks allow the interpolator value to be used
* to calculate the current progress value, which is stored in a temporary variable. The view is
* then invalidated.
* <p/>
* If this method is called when a progress update animation is already running, the previous
* animation will be cancelled, and the currently drawn progress recorded. A new animation will
* then be started from the last drawn point.
*/
private void startProgressUpdateAnimation() {
clearAnimation();
progressAnimator = ValueAnimator.ofFloat(drawnProgress, userProgress);
progressAnimator.setDuration(UPDATE_ANIM_MS);
progressAnimator.setRepeatCount(0);
progressAnimator.setRepeatMode(ValueAnimator.RESTART);
progressAnimator.setInterpolator(new DecelerateInterpolator());
progressAnimator.addUpdateListener(this);
// start striped animation after progress update if needed
progressAnimator.addListener(this);
progressAnimator.start();
}
@Override
public void onAnimationUpdate(ValueAnimator animation) {
drawnProgress = (int) ((float) animation.getAnimatedValue());
invalidate();
}
@Override
public void onAnimationStart(Animator animation) {
}
@Override
public void onAnimationEnd(Animator animation) {
startStripedAnimationIfNeeded(); // start striped animation after progress update
}
@Override
public void onAnimationCancel(Animator animation) {
}
@Override
public void onAnimationRepeat(Animator animation) {
}
/**
* Starts an infinite animation cycle which provides the visual effect of stripes moving
* backwards. The current system time is used to offset tiled bitmaps of the progress background,
* producing the effect that the stripes are moving backwards.
*/
private void startStripedAnimationIfNeeded() {
if (!striped || !animated) {
return;
}
clearAnimation();
progressAnimator = ValueAnimator.ofFloat(0, 0);
progressAnimator.setDuration(UPDATE_ANIM_MS);
progressAnimator.setRepeatCount(ValueAnimator.INFINITE);
progressAnimator.setRepeatMode(ValueAnimator.RESTART);
progressAnimator.setInterpolator(new LinearInterpolator());
progressAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator animation) {
invalidate();
}
});
progressAnimator.start();
}
/*
* Custom Measuring/Drawing
*/
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
// restrict view to default progressbar height
int width = MeasureSpec.getSize(widthMeasureSpec);
int height = MeasureSpec.getSize(heightMeasureSpec);
int heightMode = MeasureSpec.getMode(heightMeasureSpec);
switch (heightMode) {
case MeasureSpec.EXACTLY:
break;
case MeasureSpec.AT_MOST: // prefer default height, if not all available use as much as possible
float desiredHeight = (baselineHeight * bootstrapSize);
height = (height > desiredHeight) ? (int) desiredHeight : height;
break;
default:
height = (int) (baselineHeight * bootstrapSize);
break;
}
setMeasuredDimension(width, height);
}
@Override
protected void onSizeChanged(int w, int h, int oldw, int oldh) {
if (h != oldh) {
stripeTile = null; // dereference cached bitmap
}
super.onSizeChanged(w, h, oldw, oldh);
}
@Override
protected void onDraw(Canvas canvas) {
float w = getWidth();
float h = getHeight();
if (w <= 0 || h <= 0) {
return;
}
if (progressBitmap == null) {
progressBitmap = Bitmap.createBitmap((int) w, (int) h, ARGB_8888);
}
if (progressCanvas == null) {
progressCanvas = new Canvas(progressBitmap);
}
progressCanvas.drawColor(Color.TRANSPARENT, PorterDuff.Mode.CLEAR);
float ratio = (drawnProgress / (float) maxProgress);
int lineEnd = (int) (w * ratio);
float offset = 0;
float offsetFactor = (System.currentTimeMillis() % STRIPE_CYCLE_MS) / (float) STRIPE_CYCLE_MS;
if (striped && animated) { // determine offset for current animation frame of progress bar
offset = (h * 2) * offsetFactor;
}
if (striped) { // draw a regular striped bar
if (stripeTile == null) {
stripeTile = createTile(h, stripePaint, progressPaint);
}
float start = 0 - offset;
while (start < lineEnd) { // FIXME
progressCanvas.drawBitmap(stripeTile, start, 0, tilePaint);
start += stripeTile.getWidth();
}
}
else { // draw a filled bar
progressCanvas.drawRect(0, 0, lineEnd, h, progressPaint);
}
progressCanvas.drawRect(lineEnd, 0, w, h, bgPaint); // draw bg
float corners = rounded ? h / 2 : 0;
Bitmap round = createRoundedBitmap(progressBitmap, corners, canRoundRight, canRoundLeft);
canvas.drawBitmap(round, 0, 0, tilePaint);
if(showPercentage) {
String percent = getProgress() + "%";
int xPos = (lineEnd / 2);
xPos = xPos - (int) (textPaint.measureText(percent) / 2);
int yPos = (int) ((canvas.getHeight() / 2) - ((textPaint.descent() + textPaint.ascent()) / 2));
//((textPaint.descent() + textPaint.ascent()) / 2) is the distance from the baseline to the center.
canvas.drawText(percent, xPos, yPos, textPaint);
}
}
/**
* Creates a Bitmap which is a tile of the progress bar background
*
* @param h the view height
* @return a bitmap of the progress bar background
*/
private static Bitmap createTile(float h, Paint stripePaint, Paint progressPaint) {
Bitmap bm = Bitmap.createBitmap((int) h * 2, (int) h, ARGB_8888);
Canvas tile = new Canvas(bm);
float x = 0;
Path path = new Path();
path.moveTo(x, 0);
path.lineTo(x, h);
path.lineTo(h, h);
tile.drawPath(path, stripePaint); // draw striped triangle
path.reset();
path.moveTo(x, 0);
path.lineTo(x + h, h);
path.lineTo(x + (h * 2), h);
path.lineTo(x + h, 0);
tile.drawPath(path, progressPaint); // draw progress parallelogram
x += h;
path.reset();
path.moveTo(x, 0);
path.lineTo(x + h, 0);
path.lineTo(x + h, h);
tile.drawPath(path, stripePaint); // draw striped triangle (completing tile)
return bm;
}
/**
* Creates a rounded bitmap with transparent corners, from a square bitmap.
* See <a href="http://stackoverflow.com/questions/4028270">StackOverflow</a>
*
* @param bitmap the original bitmap
* @param cornerRadius the radius of the corners
* @param roundRight if you should round the corners on the right, note that if set to true and cornerRadius == 0 it will create a square
* @param roundLeft if you should round the corners on the right, note that if set to true and cornerRadius == 0 it will create a square
* @return a rounded bitmap
*/
private static Bitmap createRoundedBitmap(Bitmap bitmap, float cornerRadius, boolean roundRight, boolean roundLeft) {
Bitmap roundedBitmap = Bitmap.createBitmap(bitmap.getWidth(), bitmap.getHeight(), ARGB_8888);
Canvas canvas = new Canvas(roundedBitmap);
final Paint paint = new Paint();
final Rect frame = new Rect(0, 0, bitmap.getWidth(), bitmap.getHeight());
// final Rect frameLeft = new Rect(0, 0, bitmap.getWidth() /2, bitmap.getHeight());
// final Rect frameRight = new Rect(bitmap.getWidth() /2, bitmap.getHeight(), bitmap.getWidth(), bitmap.getHeight());
final Rect leftRect = new Rect(0, 0, bitmap.getWidth() / 2, bitmap.getHeight());
final Rect rightRect = new Rect(bitmap.getWidth() / 2, 0, bitmap.getWidth(), bitmap.getHeight());
// prepare canvas for transfer
paint.setAntiAlias(true);
paint.setColor(0xFFFFFFFF);
paint.setStyle(Paint.Style.FILL);
canvas.drawARGB(0, 0, 0, 0);
canvas.drawRoundRect(new RectF(frame), cornerRadius, cornerRadius, paint);
if (!roundLeft){
canvas.drawRect(leftRect, paint);
}
if (!roundRight){
canvas.drawRect(rightRect, paint);
}
// draw bitmap
paint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.SRC_IN));
canvas.drawBitmap(bitmap, frame, frame, paint);
return roundedBitmap;
}
private void updateBootstrapState() {
int color = bootstrapBrand.defaultFill(getContext());
progressPaint.setColor(color);
stripePaint.setColor(getStripeColor(color));
invalidateDrawCache();
invalidate();
}
private void invalidateDrawCache() {
stripeTile = null;
progressBitmap = null;
progressCanvas = null;
}
/*
* Getters/Setters
*/
@SuppressLint("DefaultLocale")
@Override
public void setProgress(int progress) {
if (getParent() instanceof BootstrapProgressBarGroup){
this.userProgress = 0;
setMaxProgress(progress);
}else {
if (progress < 0 || progress > maxProgress) {
throw new IllegalArgumentException(
String.format("Invalid value '%d' - progress must be an integer in the range 0-%d", progress, maxProgress));
}
}
this.userProgress = progress;
if (animated) {
startProgressUpdateAnimation();
}
else {
this.drawnProgress = progress;
invalidate();
}
ViewParent parent = getParent();
if (parent != null) {
if (parent instanceof BootstrapProgressBarGroup) {
BootstrapProgressBarGroup parentGroup = (BootstrapProgressBarGroup) parent;
parentGroup.onProgressChanged(this);
}
}
}
@Override
public int getProgress() {
return userProgress;
}
@Override
public void setStriped(boolean striped) {
this.striped = striped;
invalidate();
startStripedAnimationIfNeeded();
}
@Override
public boolean isStriped() {
return striped;
}
@Override
public void setAnimated(boolean animated) {
this.animated = animated;
invalidate();
startStripedAnimationIfNeeded();
}
@Override
public boolean isAnimated() {
return animated;
}
@Override
public void setBootstrapBrand(@NonNull BootstrapBrand bootstrapBrand) {
this.bootstrapBrand = bootstrapBrand;
textPaint.setColor(bootstrapBrand.defaultTextColor(getContext()));
updateBootstrapState();
}
@NonNull
@Override
public BootstrapBrand getBootstrapBrand() {
return bootstrapBrand;
}
@Override
public void setRounded(boolean rounded) {
this.rounded = rounded;
updateBootstrapState();
}
@Override
public boolean isRounded() {
return rounded;
}
@Override
public float getBootstrapSize() {
return bootstrapSize;
}
@Override
public void setBootstrapSize(float bootstrapSize) {
this.bootstrapSize = bootstrapSize;
textPaint.setTextSize((DimenUtils.pixelsFromSpResource(getContext(), R.dimen.bootstrap_progress_bar_default_font_size)) * this.bootstrapSize );
requestLayout();
updateBootstrapState();
}
@Override
public void setBootstrapSize(DefaultBootstrapSize bootstrapSize) {
setBootstrapSize(bootstrapSize.scaleFactor());
}
/**
*
* @return int, the max progress.
*/
public int getMaxProgress() {
return maxProgress;
}
/**
* Used for settings the maxprogress. Also check if currentProgress is smaller than newMaxProgress.
* @param newMaxProgress the maxProgress value
*/
public void setMaxProgress(int newMaxProgress) {
if (getProgress() <= newMaxProgress) {
maxProgress = newMaxProgress;
}
else {
throw new IllegalArgumentException(
String.format("MaxProgress cant be smaller than the current progress %d<%d", getProgress(), newMaxProgress));
}
invalidate();
BootstrapProgressBarGroup parent = (BootstrapProgressBarGroup) getParent();
}
void setCornerRounding(boolean left, boolean right){
canRoundLeft = left;
canRoundRight = right;
}
boolean getCornerRoundingLeft(){
return canRoundLeft;
}
boolean getCornerRoundingRight(){
return canRoundRight;
}
}
================================================
FILE: AndroidBootstrap/src/main/java/com/beardedhen/androidbootstrap/BootstrapProgressBarGroup.java
================================================
package com.beardedhen.androidbootstrap;
import android.content.Context;
import android.content.res.TypedArray;
import android.util.AttributeSet;
import android.util.TypedValue;
import android.view.View;
import android.view.ViewGroup;
import android.widget.LinearLayout;
import com.beardedhen.androidbootstrap.api.view.ProgressView;
import com.beardedhen.androidbootstrap.api.view.RoundableView;
/**
* BootstrapProgressBarGroups are a LinearLayout which exclusively holds BootstrapProgressBars in a horizontal orientation.
* This can be used to create the effect of stacked progress bars see <a href="http://getbootstrap.com/components/#progress-stacked">here</a>
*
* Each child will have there weight and max progress set to there progress. An empty progressbar emptyProgressBar will then be added to the end of layout if the bar is not full.
*/
public class BootstrapProgressBarGroup extends BootstrapGroup implements ProgressView, RoundableView {
private int cumulativeProgress;
private int maxProgress;
private final BootstrapProgressBar emptyProgressBar = new BootstrapProgressBar(getContext());
private int sizeOrdinal;
private boolean striped = false;
private boolean isEmptyBeingAdded = false;
private boolean rounded;
private boolean animated;
public BootstrapProgressBarGroup(Context context) {
super(context);
initialise(null);
}
public BootstrapProgressBarGroup(Context context, AttributeSet attrs) {
super(context, attrs);
initialise(attrs);
}
public BootstrapProgressBarGroup(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
initialise(attrs);
}
protected void initialise(AttributeSet attrs) {
TypedArray a = getContext().obtainStyledAttributes(attrs, R.styleable.BootstrapProgressBarGroup);
try {
this.maxProgress = a.getInt(R.styleable.BootstrapProgressBarGroup_bootstrapMaxProgress, 100);
this.sizeOrdinal = a.getInt(R.styleable.BootstrapProgressBarGroup_bootstrapSize, 2);
this.rounded = a.getBoolean(R.styleable.BootstrapProgressBarGroup_roundedCorners, false);
} finally {
a.recycle();
}
setOrientation(HORIZONTAL);
updateBootstrapGroup();
}
@Override
protected void onBootstrapViewAdded() {
addEmptyProgressBar();
updateBootstrapGroup();
}
@Override
protected void onBootstrapViewRemoved() {
addEmptyProgressBar();
updateBootstrapGroup();
}
/**
* This looks for instances of emptyProgressBar and removes them if they are not at the end and then adds one at the end if its needed.
*/
private void addEmptyProgressBar(){
int whereIsEmpty = -1;
for (int i = 0; i < getChildCount(); i++) {
if (retrieveChild(i) != null && retrieveChild(i).equals(emptyProgressBar)) {
whereIsEmpty = i;
}
}
if (whereIsEmpty != getChildCount() - 1) {
if (whereIsEmpty != -1) {
//the flowing true/false is to stop empty progressbar being added more than once as removeView and addView indirectly call this method
isEmptyBeingAdded = true;
removeView(emptyProgressBar);
isEmptyBeingAdded = false;
}
if (!isEmptyBeingAdded) {
addView(emptyProgressBar);
}
}
}
@Override
protected void updateBootstrapGroup() {
if (getChildCount() == 0) {
return;
}
cumulativeProgress = getCumulativeProgress();
int numChildren = getChildCount();
for (int i = 0; i < numChildren; i++) {
LayoutParams layoutParams = getDefultlayoutParams();
layoutParams.weight = retrieveChild(i).getProgress();
retrieveChild(i).setLayoutParams(layoutParams);
retrieveChild(i).setMaxProgress(retrieveChild(i).getProgress());
retrieveChild(i).setBootstrapSize(sizeOrdinal);
retrieveChild(i).setRounded(rounded);
retrieveChild(i).setCornerRounding(false, false);
}
//this means that rounded corners will display correctly by telling only the first child to draw the left edge as rounded and only the last to draw right edge as rounded
retrieveChild(0).setCornerRounding(true, false);
retrieveChild(numChildren - 1).setCornerRounding(false, true);
//update empty progressbar attributes
LayoutParams layoutParams = getDefultlayoutParams();
layoutParams.weight = (float) maxProgress - cumulativeProgress;
emptyProgressBar.setLayoutParams(layoutParams);
emptyProgressBar.setMaxProgress(maxProgress - cumulativeProgress);
emptyProgressBar.setBootstrapSize(sizeOrdinal);
setWeightSum((float)maxProgress);
}
private LinearLayout.LayoutParams getDefultlayoutParams(){
int height = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 0, getResources().getDisplayMetrics());
LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(height, ViewGroup.LayoutParams.WRAP_CONTENT);
return layoutParams;
}
/**
* This get the total progress of all the children
* @return the CumulativeProgress i.e. the total progress of all children
*/
public int getCumulativeProgress(){
int numChildren = getChildCount();
int total = 0;
for (int i = 0; i < numChildren; i++) {
total += getChildProgress(i);
}
checkCumulativeSmallerThanMax(maxProgress, total);
return total;
}
private void checkCumulativeSmallerThanMax(int max, int cumulative){
StringBuilder builder = new StringBuilder();
builder.append("Max Progress Cant be smaller than cumulative progress. Max = ");
builder.append(max);
builder.append(", cumlative = ");
builder.append(cumulative);
builder.append(". \n");
for (int i = 0; i < getChildCount(); i++) {
builder.append("Child ").append(i).append(" has progress ").append(getChildProgress(i));
}
if (max < cumulative){
throw new IllegalStateException(builder.toString());
}
}
private int getChildProgress(int i){
return retrieveChild(i).getProgress();
}
private BootstrapProgressBar retrieveChild(int i) {
View view = getChildAt(i);
if ((view instanceof BootstrapProgressBar)) {
return (BootstrapProgressBar) view;
}
else {
throw new IllegalStateException("All child view of BootstrapProgressBarGroup must be BootstrapProgressBar");
}
}
/**
* this should be called by all children to notify the BootstrapProgressBarGroup that there progress has changed
* @param bootstrapProgressBar the child View
*/
public void onProgressChanged(BootstrapProgressBar bootstrapProgressBar){
updateBootstrapGroup();
}
/**
*
* @return int maxProgress. Returns the maxProgress value
*/
public int getMaxProgress(){
return maxProgress;
}
/**
* Used for settings the maxprogress. Also check if Cumulative progress is smaller than the max before asigning, see {@link #checkCumulativeSmallerThanMax}.
* @param maxProgress the maxProgress value
*/
public void setMaxProgress(int maxProgress){
checkCumulativeSmallerThanMax(maxProgress, cumulativeProgress);
this.maxProgress = maxProgress;
}
/**
*
* @param rounded if it should display rounded corners. true will round the corners, false wont
*/
@Override
public void setRounded(boolean rounded){
this.rounded = rounded;
updateBootstrapGroup();
}
/**
*
* @return a boolean weather the progressbarGroup will have rounded edges
*/
@Override
public boolean isRounded(){
return rounded;
}
@Override
public void setProgress(int progress) {
throw new IllegalStateException("This method not applicable for type BootstrapProgressBarGroup");
}
@Override
public int getProgress() {
throw new IllegalStateException("This method not applicable for type BootstrapProgressBarGroup");
}
/**
* This will set all children to striped.
* @param striped true for a striped pattern, false for a plain pattern
*/
@Override
public void setStriped(boolean striped) {
this.striped = striped;
for (int i = 0; i < getChildCount(); i++) {
retrieveChild(i).setStriped(striped);
}
}
/**
* This will only be true if setStriped(true) was called
* @return striped true for a striped pattern, false for a plain pattern
*/
@Override
public boolean isStriped() {
return striped;
}
/**
*
* @param animated whether the view should animate its updates or not.
*/
@Override
public void setAnimated(boolean animated) {
this.animated = animated;
for (int i = 0; i < getChildCount(); i++) {
retrieveChild(i).setAnimated(animated);
}
}
/**
* This will only be true if setAnimated(true) was called
* @return animated if all children have been set to be animated (through the Group)
*/
@Override
public boolean isAnimated() {
return animated;
}
}
================================================
FILE: AndroidBootstrap/src/main/java/com/beardedhen/androidbootstrap/BootstrapText.java
================================================
package com.beardedhen.androidbootstrap;
import android.content.Context;
import android.text.SpannableString;
import android.text.Spanned;
import com.beardedhen.androidbootstrap.font.AwesomeTypefaceSpan;
import com.beardedhen.androidbootstrap.font.FontAwesome;
import com.beardedhen.androidbootstrap.font.IconSet;
import com.beardedhen.androidbootstrap.font.MaterialIcons;
import com.beardedhen.androidbootstrap.font.Typicon;
import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;
/**
* Bootstrap Text provides a Builder class, which allows convenient construction of SpannableStrings.
* Currently regular text, FontAwesome icons, and Typicons can be added.
*/
public class BootstrapText extends SpannableString implements Serializable {
private BootstrapText(CharSequence source) {
super(source);
}
/**
* This class should be used to construct BootstrapText instances. Text is appended to itself
* in the order in which it was added.
*/
public static class Builder {
private final StringBuilder sb;
private final Context context;
private final boolean editMode;
private final Map<Integer, IconSet> fontIndicesMap;
public Builder(Context context) {
fontIndicesMap = new HashMap<>();
sb = new StringBuilder();
this.context = context.getApplicationContext();
this.editMode = false;
}
public Builder(Context context, boolean editMode) {
fontIndicesMap = new HashMap<>();
sb = new StringBuilder();
this.context = context.getApplicationContext();
this.editMode = editMode;
}
/**
* Appends a regular piece of text to the BootstrapText under construction.
*
* @param text a regular piece of text
* @return the updated builder instance
*/
public Builder addText(CharSequence text) {
sb.append(text);
return this;
}
/**
* Appends a FontAwesomeIcon to the BootstrapText under construction
*
* @return the updated builder instance
*/
public Builder addFontAwesomeIcon(@FontAwesome.Icon CharSequence iconCode) {
IconSet iconSet = TypefaceProvider.retrieveRegisteredIconSet(FontAwesome.FONT_PATH, editMode);
sb.append(iconSet.unicodeForKey(iconCode.toString().replaceAll("\\-", "_")));
fontIndicesMap.put(sb.length(), iconSet);
return this;
}
/**
* Appends a Typicon to the BootstrapText under construction
*
* @return the updated builder instance
*/
public Builder addTypicon(@Typicon.Icon CharSequence iconCode) {
IconSet iconSet = TypefaceProvider.retrieveRegisteredIconSet(Typicon.FONT_PATH, editMode);
sb.append(iconSet.unicodeForKey(iconCode.toString().replaceAll("\\-", "_")));
fontIndicesMap.put(sb.length(), iconSet);
return this;
}
/**
* Appends a Typicon to the BootstrapText under construction
*
* @return the updated builder instance
*/
public Builder addMaterialIcon( CharSequence iconCode) {
IconSet iconSet = TypefaceProvider.retrieveRegisteredIconSet(MaterialIcons.FONT_PATH, editMode);
sb.append(iconSet.unicodeForKey(iconCode.toString().replaceAll("\\-", "_")));
fontIndicesMap.put(sb.length(), iconSet);
return this;
}
/**
* Appends a font icon to the BootstrapText under construction
*
* @param iconSet a font icon
* @return the updated builder instance
*/
public Builder addIcon(CharSequence iconCode, IconSet iconSet) {
sb.append(iconSet.unicodeForKey(iconCode.toString().replaceAll("\\-", "_")));
fontIndicesMap.put(sb.length(), iconSet);
return this;
}
/**
* @return a new instance of BootstrapText, constructed according to Builder arguments.
*/
public BootstrapText build() {
BootstrapText bootstrapText = new BootstrapText(sb.toString());
for (Map.Entry<Integer, IconSet> entry : fontIndicesMap.entrySet()) {
int index = entry.getKey();
AwesomeTypefaceSpan span = new AwesomeTypefaceSpan(context, entry.getValue());
bootstrapText.setSpan(span, index - 1, index, Spanned.SPAN_INCLUSIVE_INCLUSIVE);
}
return bootstrapText;
}
}
}
================================================
FILE: AndroidBootstrap/src/main/java/com/beardedhen/androidbootstrap/BootstrapThumbnail.java
================================================
package com.beardedhen.androidbootstrap;
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.RectF;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.os.Bundle;
import android.os.Parcelable;
import android.util.AttributeSet;
import com.beardedhen.androidbootstrap.api.defaults.DefaultBootstrapBrand;
import com.beardedhen.androidbootstrap.api.defaults.DefaultBootstrapSize;
import com.beardedhen.androidbootstrap.api.view.RoundableView;
import com.beardedhen.androidbootstrap.utils.ColorUtils;
import com.beardedhen.androidbootstrap.utils.ViewUtils;
/**
* BootstrapThumbnail displays a rectangular image with an optional border, that can be
* themed. The view extends ImageView, and will automatically center crop and
* scale images.
*/
public class BootstrapThumbnail extends BootstrapBaseThumbnail implements RoundableView {
private static final String TAG = "com.beardedhen.androidbootstrap.BootstrapThumbnail";
private Paint placeholderPaint;
private final RectF imageRect = new RectF();
private boolean roundedCorners;
private float baselineCornerRadius;
public BootstrapThumbnail(Context context) {
super(context);
initialise(null);
}
public BootstrapThumbnail(Context context, AttributeSet attrs) {
super(context, attrs);
initialise(attrs);
}
public BootstrapThumbnail(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
initialise(attrs);
}
@Override public Parcelable onSaveInstanceState() {
Bundle bundle = new Bundle();
bundle.putParcelable(TAG, super.onSaveInstanceState());
bundle.putBoolean(RoundableView.KEY, roundedCorners);
return bundle;
}
@Override public void onRestoreInstanceState(Parcelable state) {
if (state instanceof Bundle) {
Bundle bundle = (Bundle) state;
this.roundedCorners = bundle.getBoolean(RoundableView.KEY);
state = bundle.getParcelable(TAG);
}
super.onRestoreInstanceState(state);
}
protected void initialise(AttributeSet attrs) {
TypedArray a = getContext().obtainStyledAttributes(attrs, R.styleable.BootstrapThumbnail);
try {
int typeOrdinal = a.getInt(R.styleable.BootstrapThumbnail_bootstrapBrand, -1);
int sizeOrdinal = a.getInt(R.styleable.BootstrapThumbnail_bootstrapSize, -1);
this.hasBorder = a.getBoolean(R.styleable.BootstrapCircleThumbnail_hasBorder, true);
this.bootstrapSize = DefaultBootstrapSize.fromAttributeValue(sizeOrdinal).scaleFactor();
if (typeOrdinal == -1) { // override to use Primary for default border (looks nicer)
this.bootstrapBrand = DefaultBootstrapBrand.PRIMARY;
}
else {
this.bootstrapBrand = DefaultBootstrapBrand.fromAttributeValue(typeOrdinal);
}
}
finally {
a.recycle();
}
placeholderPaint = new Paint();
placeholderPaint.setColor(ColorUtils.resolveColor(R.color.bootstrap_gray_light, getContext()));
placeholderPaint.setStyle(Paint.Style.FILL);
placeholderPaint.setAntiAlias(true);
this.baselineCornerRadius = getResources().getDimension(R.dimen.bthumbnail_rounded_corner);
this.baselineBorderWidth = getResources().getDimension(R.dimen.bthumbnail_default_border);
setScaleType(ScaleType.CENTER_CROP);
super.initialise(attrs);
}
protected void updateImageState() {
updateBackground();
updatePadding();
invalidate();
}
private void updateBackground() {
Drawable bg = null;
if (hasBorder) {
bg = BootstrapDrawableFactory.bootstrapThumbnail(
getContext(),
bootstrapBrand,
(int) (baselineOuterBorderWidth * bootstrapSize),
ColorUtils.resolveColor(R.color.bootstrap_thumbnail_background, getContext()),
roundedCorners);
}
ViewUtils.setBackgroundDrawable(this, bg);
}
private void updatePadding() {
if (Build.VERSION.SDK_INT >= 16) {
int p = hasBorder ? (int) (baselineBorderWidth * bootstrapSize) : 0;
setPadding(p, p, p, p);
setCropToPadding(hasBorder);
}
}
@Override protected void onDraw(Canvas canvas) {
if (sourceBitmap == null) { // draw a placeholder
float padding = hasBorder ? (baselineBorderWidth * bootstrapSize) : 0;
imageRect.top = padding;
imageRect.bottom = getHeight() - padding;
imageRect.left = padding;
imageRect.right = getWidth() - padding;
if (roundedCorners) {
canvas.drawRoundRect(
imageRect,
(baselineCornerRadius * bootstrapSize),
(baselineCornerRadius * bootstrapSize),
placeholderPaint);
}
else {
canvas.drawRect(imageRect, placeholderPaint);
}
}
else {
super.onDraw(canvas);
}
}
/*
* Getters/setters
*/
@Override public void setRounded(boolean rounded) {
this.roundedCorners = rounded;
updateImageState();
}
@Override public boolean isRounded() {
return roundedCorners;
}
}
================================================
FILE: AndroidBootstrap/src/main/java/com/beardedhen/androidbootstrap/BootstrapWell.java
================================================
package com.beardedhen.androidbootstrap;
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.drawable.Drawable;
import android.util.AttributeSet;
import android.widget.FrameLayout;
import com.beardedhen.androidbootstrap.api.defaults.DefaultBootstrapSize;
import com.beardedhen.androidbootstrap.utils.ColorUtils;
import com.beardedhen.androidbootstrap.utils.DimenUtils;
import com.beardedhen.androidbootstrap.utils.ViewUtils;
/**
* BootstrapWells are used as a container layout for other views, typically text.
*/
public class BootstrapWell extends FrameLayout {
private float bootstrapSize;
public BootstrapWell(Context context) {
super(context);
initialise(null);
}
public BootstrapWell(Context context, AttributeSet attrs) {
super(context, attrs);
initialise(attrs);
}
public BootstrapWell(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
initialise(attrs);
}
private void initialise(AttributeSet attrs) {
TypedArray a = getContext().obtainStyledAttributes(attrs, R.styleable.BootstrapButton);
try {
int sizeOrdinal = a.getInt(R.styleable.BootstrapButton_bootstrapSize, -1);
bootstrapSize = DefaultBootstrapSize.fromAttributeValue(sizeOrdinal).scaleFactor();
}
finally {
a.recycle();
}
updateBootstrapState();
}
private void updateBootstrapState() {
Drawable bg = BootstrapDrawableFactory.bootstrapWell(ColorUtils.resolveColor(R.color.bootstrap_well_background, getContext()),
(int) (DimenUtils.pixelsFromDpResource(getContext(), R.dimen.bootstrap_well_corner_radius) * bootstrapSize / 2),
(int) DimenUtils.pixelsFromDpResource(getContext(), R.dimen.bootstrap_well_stroke_width),
ColorUtils.resolveColor(R.color.bootstrap_well_border_color, getContext()));
ViewUtils.setBackgroundDrawable(this, bg);
int padding = (int) (DimenUtils.pixelsFromDpResource(getContext(), R.dimen.bootstrap_well_default_padding) * bootstrapSize * 2.5);
setPadding(padding, padding, padding, padding);
}
}
================================================
FILE: AndroidBootstrap/src/main/java/com/beardedhen/androidbootstrap/IconResolver.java
================================================
package com.beardedhen.androidbootstrap;
import android.content.Context;
import com.beardedhen.androidbootstrap.font.FontAwesome;
import com.beardedhen.androidbootstrap.font.IconSet;
import com.beardedhen.androidbootstrap.font.MaterialIcons;
import com.beardedhen.androidbootstrap.font.Typicon;
import static com.beardedhen.androidbootstrap.TypefaceProvider.getRegisteredIconSets;
import static com.beardedhen.androidbootstrap.TypefaceProvider.retrieveRegisteredIconSet;
/**
* Resolves markdown strings using FA codes and produces BootstrapText instances.
*/
class IconResolver {
private static final String REGEX_FONT_AWESOME = "(fa_|fa-)[a-z_0-9]+";
private static final String REGEX_TYPICONS = "(ty_|ty-)[a-z_0-9]+";
private static final String REGEX_MATERIAL_ICONS = "(md_)[a-z_0-9]+";
/**
* Resolves markdown to produce a BootstrapText instance. e.g. "{fa_android}" would be replaced
* with the appropriate FontAwesome character and a SpannableString producec.
*
* @param context the current context
* @param markdown the markdown string
* @param editMode - whether the view requesting the icon set is displayed in the preview editor
* @return a constructed BootstrapText
*/
static BootstrapText resolveMarkdown(Context context, String markdown, boolean editMode) {
if (markdown == null) {
return null;
}
else { // detect {fa_*} and split into spannable, ignore escaped chars
BootstrapText.Builder builder = new BootstrapText.Builder(context, editMode);
int lastAddedIndex = 0;
int startIndex = -1;
int endIndex = -1;
for (int i = 0; i < markdown.length(); i++) {
char c = markdown.charAt(i);
if (c == '\\') { // escape sequence, ignore next char
i += 2;
continue;
}
if (c == '{') {
startIndex = i;
}
else if (c == '}') {
endIndex = i;
}
if (startIndex != -1 && endIndex != -1) { // recognised markdown string
if (startIndex >= 0 && endIndex < markdown.length()) {
String iconCode = markdown.substring(startIndex + 1, endIndex).replaceAll("\\-", "_");
builder.addText(markdown.substring(lastAddedIndex, startIndex));
if (iconCode.matches(REGEX_FONT_AWESOME)) { // text is FontAwesome code
if (editMode) {
builder.addText("?");
}
else {
builder.addIcon(iconCode, retrieveRegisteredIconSet(FontAwesome.FONT_PATH, false));
}
}
else if (iconCode.matches(REGEX_TYPICONS)) {
if (editMode) {
builder.addText("?");
}
else {
builder.addIcon(iconCode, retrieveRegisteredIconSet(Typicon.FONT_PATH, false));
}
}
else if(iconCode.matches(REGEX_MATERIAL_ICONS)){
if (editMode) {
builder.addText("?");
}
else {
builder.addIcon(iconCode, retrieveRegisteredIconSet(MaterialIcons.FONT_PATH, false));
}
}
else {
if (editMode) {
builder.addText("?");
}
else {
builder.addIcon(iconCode, resolveIconSet(iconCode));
}
}
lastAddedIndex = endIndex + 1;
}
startIndex = -1;
endIndex = -1;
}
}
return builder.addText(markdown.substring(lastAddedIndex, markdown.length())).build();
}
}
/**
* Searches for the unicode character value for the Font Icon Code. This method searches all
* active FontIcons in the application.
*
* @param iconCode the font icon code
* @return the unicode character matching the icon, or null if none matches
*/
private static IconSet resolveIconSet(String iconCode) {
CharSequence unicode;
for (IconSet set : getRegisteredIconSets()) {
if (set.fontPath().equals(FontAwesome.FONT_PATH) || set.fontPath().equals(Typicon.FONT_PATH) || set.fontPath().equals(MaterialIcons.FONT_PATH)) {
continue; // already checked previously, ignore
}
unicode = set.unicodeForKey(iconCode);
if (unicode != null) {
return set;
}
}
String message = String.format("Could not find FontIcon value for '%s', " +
"please ensure that it is mapped to a valid font", iconCode);
throw new IllegalArgumentException(message);
}
}
================================================
FILE: AndroidBootstrap/src/main/java/com/beardedhen/androidbootstrap/TypefaceProvider.java
================================================
package com.beardedhen.androidbootstrap;
import android.content.Context;
import android.graphics.Typeface;
import com.beardedhen.androidbootstrap.font.FontAwesome;
import com.beardedhen.androidbootstrap.font.IconSet;
import com.beardedhen.androidbootstrap.font.MaterialIcons;
import com.beardedhen.androidbootstrap.font.Typicon;
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
/**
* Holds static instances of Typefaces, and IconSets, allowing views to use them across the application
* without expensive initialisation.
*/
public class TypefaceProvider {
private final static Map<CharSequence, Typeface> TYPEFACE_MAP = new HashMap<>();
private final static Map<CharSequence, IconSet> REGISTERED_ICON_SETS = new HashMap<>();
/**
* Returns a reference to the requested typeface, creating a new instance if none already exists
*
* @param context the current context
* @param iconSet the icon typeface
* @return a reference to the typeface instance
*/
public static Typeface getTypeface(Context context, IconSet iconSet) {
String path = iconSet.fontPath().toString();
if (TYPEFACE_MAP.get(path) == null) {
final Typeface font = Typeface.createFromAsset(context.getAssets(), path);
TYPEFACE_MAP.put(path, font);
}
return TYPEFACE_MAP.get(path);
}
/**
* Registers instances of the Default IconSets so that they are available throughout the whole
* application. Currently the default icon sets include FontAwesome and Typicon.
*/
public static void registerDefaultIconSets() {
final FontAwesome fontAwesome = new FontAwesome();
final Typicon typicon = new Typicon();
final MaterialIcons materialIcons = new MaterialIcons();
REGISTERED_ICON_SETS.put(fontAwesome.fontPath(), fontAwesome);
REGISTERED_ICON_SETS.put(typicon.fontPath(), typicon);
REGISTERED_ICON_SETS.put(materialIcons.fontPath(), materialIcons);
}
/**
* Registers a custom IconSet, so that it is available for use throughout the whole application.
*
* @param iconSet a custom IconSet
*/
public static void registerCustomIconSet(IconSet iconSet) {
REGISTERED_ICON_SETS.put(iconSet.fontPath(), iconSet);
}
/**
* Retrieves a registered IconSet whose font can be found in the asset directory at the given path
*
* @param fontPath the given path
* @param editMode - whether the view requesting the icon set is displayed in the preview editor
* @return the registered IconSet instance
*/
public static IconSet retrieveRegisteredIconSet(String fontPath, boolean editMode) {
final IconSet iconSet = REGISTERED_ICON_SETS.get(fontPath);
if (iconSet == null && !editMode) {
throw new RuntimeException(String.format("Font '%s' not properly registered, please" +
" see the README at https://github.com/Bearded-Hen/Android-Bootstrap", fontPath));
}
return iconSet;
}
/**
* Retrieves a collection of all registered IconSets in the application
*
* @return a collection of registered IconSets.
*/
public static Collection<IconSet> getRegisteredIconSets() {
return REGISTERED_ICON_SETS.values();
}
}
================================================
FILE: AndroidBootstrap/src/main/java/com/beardedhen/androidbootstrap/api/attributes/BootstrapBrand.java
================================================
package com.beardedhen.androidbootstrap.api.attributes;
import android.content.Context;
import android.support.annotation.ColorInt;
import java.io.Serializable;
/**
* A Bootstrap Brand is a color which is used universally across many Bootstrap Views. An example is
* the 'Info' Brand which colors views light blue.
*/
public interface BootstrapBrand extends Serializable {
String KEY = "BootstrapBrand";
/**
* Retrieves the color that should be used for the default fill state
*
* @param context the current context
* @return the color for the current brand
*/
@ColorInt int defaultFill(Context context);
/**
* Retrieves the color that should be used for the default border state
*
* @param context the current context
* @return the color for the current brand
*/
@ColorInt int defaultEdge(Context context);
/**
* Retrieves the text color that should be used for the default state
*
* @param context the current context
* @return the color for the current brand
*/
@ColorInt int defaultTextColor(Context context);
/**
* Retrieves the color that should be used for the active fill state
*
* @param context the current context
* @return the color for the current brand
*/
@ColorInt int activeFill(Context context);
/**
* Retrieves the color that should be used for the active border state
*
* @param context the current context
* @return the color for the current brand
*/
@ColorInt int activeEdge(Context context);
/**
* Retrieves the text color that should be used for the active state
*
* @param context the current context
* @return the color for the current brand
*/
@ColorInt int activeTextColor(Context context);
/**
* Retrieves the color that should be used for the disabled fill state
*
* @param context the current context
* @return the color for the current brand
*/
@ColorInt int disabledFill(Context context);
/**
* Retrieves the color that should be used for the disabled border state
*
* @param context the current context
* @return the color for the current brand
*/
@ColorInt int disabledEdge(Context context);
/**
* Retrieves the text color that should be used for the disabled state
*
* @param context the current context
* @return the color for the current brand
*/
@ColorInt int disabledTextColor(Context context);
@ColorInt int getColor();
}
================================================
FILE: AndroidBootstrap/src/main/java/com/beardedhen/androidbootstrap/api/attributes/BootstrapHeading.java
================================================
package com.beardedhen.androidbootstrap.api.attributes;
import android.content.Context;
import java.io.Serializable;
/**
* A Heading defines the text size and padding of its view. Bootstrap supports styles for H1-H6
* elements out of the box.
*/
public interface BootstrapHeading extends Serializable {
String KEY = "com.beardedhen.androidbootstrap.api.attributes.BootstrapHeading";
/**
* Retrieves the text size for the current BootstrapHeading.
*
* @param context the current context
* @return the text size
*/
float getTextSize(Context context);
/**
* Retrieves the vertical padding for the current BootstrapHeading
*
* @param context the current context
* @return the vertical padding
*/
float verticalPadding(Context context);
/**
* Retrieves the horizontal padding for the current BootstrapHeading
*
* @param context the current context
* @return the horizontal padding
*/
float horizontalPadding(Context context);
}
================================================
FILE: AndroidBootstrap/src/main/java/com/beardedhen/androidbootstrap/api/attributes/ViewGroupPosition.java
================================================
package com.beardedhen.androidbootstrap.api.attributes;
public enum ViewGroupPosition {
SOLO,
MIDDLE_HORI,
MIDDLE_VERT,
TOP,
BOTTOM,
START,
END
}
================================================
FILE: AndroidBootstrap/src/main/java/com/beardedhen/androidbootstrap/api/defaults/ButtonMode.java
================================================
package com.beardedhen.androidbootstrap.api.defaults;
public enum ButtonMode {
REGULAR,
TOGGLE,
CHECKBOX,
RADIO;
public static ButtonMode fromAttributeValue(int attrValue) {
switch (attrValue) {
case 0:
return REGULAR;
case 1:
return TOGGLE;
case 2:
return CHECKBOX;
case 3:
return RADIO;
default:
return REGULAR;
}
}
}
================================================
FILE: AndroidBootstrap/src/main/java/com/beardedhen/androidbootstrap/api/defaults/DefaultBootstrapBrand.java
================================================
package com.beardedhen.androidbootstrap.api.defaults;
import android.content.Context;
import android.support.annotation.ColorInt;
import com.beardedhen.androidbootstrap.R;
import com.beardedhen.androidbootstrap.api.attributes.BootstrapBrand;
import static com.beardedhen.androidbootstrap.utils.ColorUtils.ACTIVE_OPACITY_FACTOR_EDGE;
import static com.beardedhen.androidbootstrap.utils.ColorUtils.ACTIVE_OPACITY_FACTOR_FILL;
import static com.beardedhen.androidbootstrap.utils.ColorUtils.DISABLED_ALPHA_EDGE;
import static com.beardedhen.androidbootstrap.utils.ColorUtils.DISABLED_ALPHA_FILL;
import static com.beardedhen.androidbootstrap.utils.ColorUtils.decreaseRgbChannels;
import static com.beardedhen.androidbootstrap.utils.ColorUtils.increaseOpacity;
import static com.beardedhen.androidbootstrap.utils.ColorUtils.resolveColor;
/**
* Bootstrap provides 6 brands by default - Primary, Success, Info, Warning, Danger, and Default.
* Brands are often supplemented by view-specific colors, which are <b>not</b> globally used.
*/
public enum DefaultBootstrapBrand implements BootstrapBrand {
PRIMARY(R.color.bootstrap_brand_primary),
SUCCESS(R.color.bootstrap_brand_success),
INFO(R.color.bootstrap_brand_info),
WARNING(R.color.bootstrap_brand_warning),
DANGER(R.color.bootstrap_brand_danger),
SECONDARY(R.color.bootstrap_brand_secondary_fill, R.color.bootstrap_brand_secondary_text),
REGULAR(R.color.bootstrap_gray_light);
private final int textColor;
private final int color;
DefaultBootstrapBrand(int color) {
this.color = color;
this.textColor = android.R.color.white;
}
DefaultBootstrapBrand(int color, int textColor) {
this.color = color;
this.textColor = textColor;
}
public static DefaultBootstrapBrand fromAttributeValue(int attrValue) {
switch (attrValue) {
case 0:
return PRIMARY;
case 1:
return SUCCESS;
case 2:
return INFO;
case 3:
return WARNING;
case 4:
return DANGER;
case 5:
return REGULAR;
case 6:
return SECONDARY;
default:
return REGULAR;
}
}
@ColorInt public int defaultFill(Context context) {
return resolveColor(color, context);
}
@ColorInt public int defaultEdge(Context context) {
return decreaseRgbChannels(context, color, ACTIVE_OPACITY_FACTOR_EDGE);
}
@ColorInt public int activeFill(Context context) {
return decreaseRgbChannels(context, color, ACTIVE_OPACITY_FACTOR_FILL);
}
@ColorInt public int activeEdge(Context context) {
return decreaseRgbChannels(context, color, ACTIVE_OPACITY_FACTOR_FILL + ACTIVE_OPACITY_FACTOR_EDGE);
}
@ColorInt public int disabledFill(Context context) {
return increaseOpacity(context, color, DISABLED_ALPHA_FILL);
}
@ColorInt public int disabledEdge(Context context) {
return increaseOpacity(context, color, DISABLED_ALPHA_FILL - DISABLED_ALPHA_EDGE);
}
@ColorInt public int defaultTextColor(Context context) {
return resolveColor(textColor, context);
}
@ColorInt public int activeTextColor(Context context) {
return resolveColor(textColor, context);
}
@ColorInt public int disabledTextColor(Context context) {
return resolveColor(textColor, context);
}
@ColorInt public int getColor() {
return color;
}
}
================================================
FILE: AndroidBootstrap/src/main/java/com/beardedhen/androidbootstrap/api/defaults/DefaultBootstrapHeading.java
================================================
package com.beardedhen.androidbootstrap.api.defaults;
import android.content.Context;
import android.support.annotation.DimenRes;
import com.beardedhen.androidbootstrap.R;
import com.beardedhen.androidbootstrap.api.attributes.BootstrapHeading;
import com.beardedhen.androidbootstrap.utils.DimenUtils;
/**
* Bootstrap provides styling for elements H1-H6, and sets their text size and padding using the
* values supplied here.
*/
public enum DefaultBootstrapHeading implements BootstrapHeading {
H1(R.dimen.bootstrap_h1_text_size,
R.dimen.bootstrap_h1_vert_padding,
R.dimen.bootstrap_h1_hori_padding),
H2(R.dimen.bootstrap_h2_text_size,
R.dimen.bootstrap_h2_vert_padding,
R.dimen.bootstrap_h2_hori_padding),
H3(R.dimen.bootstrap_h3_text_size,
R.dimen.bootstrap_h3_vert_padding,
R.dimen.bootstrap_h3_hori_padding),
H4(R.dimen.bootstrap_h4_text_size,
R.dimen.bootstrap_h4_vert_padding,
R.dimen.bootstrap_h4_hori_padding),
H5(R.dimen.bootstrap_h5_text_size,
R.dimen.bootstrap_h5_vert_padding,
R.dimen.bootstrap_h5_hori_padding),
H6(R.dimen.bootstrap_h6_text_size,
R.dimen.bootstrap_h6_vert_padding,
R.dimen.bootstrap_h6_hori_padding);
private final @DimenRes int textSize;
private final @DimenRes int vertPadding;
private final @DimenRes int horiPadding;
DefaultBootstrapHeading(int textSize, int vertPadding, int horiPadding) {
this.textSize = textSize;
this.vertPadding = vertPadding;
this.horiPadding = horiPadding;
}
public static DefaultBootstrapHeading fromAttributeValue(int attrValue) {
switch (attrValue) {
case 0:
return H1;
case 1:
return H2;
case 2:
return H3;
case 3:
return H4;
case 4:
return H5;
case 5:
return H6;
default:
return H6;
}
}
@Override public float getTextSize(Context context) {
return DimenUtils.pixelsFromSpResource(context, textSize);
}
@Override public float verticalPadding(Context context) {
return DimenUtils.pixelsFromDpResource(context, vertPadding);
}
@Override public float horizontalPadding(Context context) {
return DimenUtils.pixelsFromDpResource(context, horiPadding);
}
}
================================================
FILE: AndroidBootstrap/src/main/java/com/beardedhen/androidbootstrap/api/defaults/DefaultBootstrapSize.java
================================================
package com.beardedhen.androidbootstrap.api.defaults;
/**
* Bootstrap provides 5 sizes - XS, SM, MD, LG, and XL. In the Android implementation the scale
* factors used are 0.70, 0.85, 1.00, 1.30, and 1.60 respectively.
*/
public enum DefaultBootstrapSize {
XS(),
SM(),
MD(),
LG(),
XL();
public static DefaultBootstrapSize fromAttributeValue(int attrValue) {
switch (attrValue) {
case 0:
return XS;
case 1:
return SM;
case 2:
return MD;
case 3:
return LG;
case 4:
return XL;
default:
return MD;
}
}
public float scaleFactor() {
switch (this) {
case XS:
return 0.70f;
case SM:
return 0.85f;
case MD:
return 1.00f;
case LG:
return 1.30f;
case XL:
return 1.60f;
default:
return 1.00f;
}
}
}
================================================
FILE: AndroidBootstrap/src/main/java/com/beardedhen/androidbootstrap/api/defaults/ExpandDirection.java
================================================
package com.beardedhen.androidbootstrap.api.defaults;
public enum ExpandDirection {
UP,
DOWN;
public static ExpandDirection fromAttributeValue(int attrValue) {
switch (attrValue) {
case 0:
return UP;
case 1:
return DOWN;
default:
return DOWN;
}
}
}
================================================
FILE: AndroidBootstrap/src/main/java/com/beardedhen/androidbootstrap/api/view/BadgeContainerView.java
================================================
package com.beardedhen.androidbootstrap.api.view;
import com.beardedhen.androidbootstrap.BootstrapBadge;
/**
* Classes which implement this interface can be used as BootstrapBadge container.
* For example, a Button can be set up with BootstrapBadge.
*/
public interface BadgeContainerView extends BootstrapBadgeView {
String KEY = "com.beardedhen.androidbootstrap.api.view.BadgeContainerView";
/**
* Sets the badge object to be used inside a container.
*
* @param badge BootstrapBadge to setup
*/
void setBadge(BootstrapBadge badge);
/**
* Retrieves BootstrapBadge object from container view.
*
* @return BootstrapBadge if exist or null if not
*/
BootstrapBadge getBootstrapBadge();
/**
* Method where badge display logic must be implemented
*
*/
void displayBadgeDrawable();
}
================================================
FILE: AndroidBootstrap/src/main/java/com/beardedhen/androidbootstrap/api/view/BootstrapBadgeView.java
================================================
package com.beardedhen.androidbootstrap.api.view;
import android.support.annotation.Nullable;
public interface BootstrapBadgeView {
/**
* Retrieves the currently displayed badge text
*
* @return the badge text
*/
@Nullable
String getBadgeText();
/**
* Updates the badge to display a text string
*
* @param badgeText the badge text
*/
void setBadgeText(@Nullable String badgeText);
}
================================================
FILE: AndroidBootstrap/src/main/java/com/beardedhen/androidbootstrap/api/view/BootstrapBrandView.java
================================================
package com.beardedhen.androidbootstrap.api.view;
import android.support.annotation.NonNull;
import com.b
gitextract_i4nmgdax/ ├── .gitignore ├── ADD_FONT.md ├── AndroidBootstrap/ │ ├── build.gradle │ ├── proguard-project.txt │ ├── push.gradle │ └── src/ │ └── main/ │ ├── AndroidManifest.xml │ ├── java/ │ │ └── com/ │ │ └── beardedhen/ │ │ └── androidbootstrap/ │ │ ├── AwesomeTextView.java │ │ ├── BetaApi.java │ │ ├── BootstrapAlert.java │ │ ├── BootstrapBadge.java │ │ ├── BootstrapBaseThumbnail.java │ │ ├── BootstrapButton.java │ │ ├── BootstrapButtonGroup.java │ │ ├── BootstrapCircleThumbnail.java │ │ ├── BootstrapDrawableFactory.java │ │ ├── BootstrapDropDown.java │ │ ├── BootstrapEditText.java │ │ ├── BootstrapGroup.java │ │ ├── BootstrapLabel.java │ │ ├── BootstrapProgressBar.java │ │ ├── BootstrapProgressBarGroup.java │ │ ├── BootstrapText.java │ │ ├── BootstrapThumbnail.java │ │ ├── BootstrapWell.java │ │ ├── IconResolver.java │ │ ├── TypefaceProvider.java │ │ ├── api/ │ │ │ ├── attributes/ │ │ │ │ ├── BootstrapBrand.java │ │ │ │ ├── BootstrapHeading.java │ │ │ │ └── ViewGroupPosition.java │ │ │ ├── defaults/ │ │ │ │ ├── ButtonMode.java │ │ │ │ ├── DefaultBootstrapBrand.java │ │ │ │ ├── DefaultBootstrapHeading.java │ │ │ │ ├── DefaultBootstrapSize.java │ │ │ │ └── ExpandDirection.java │ │ │ └── view/ │ │ │ ├── BadgeContainerView.java │ │ │ ├── BootstrapBadgeView.java │ │ │ ├── BootstrapBrandView.java │ │ │ ├── BootstrapHeadingView.java │ │ │ ├── BootstrapSizeView.java │ │ │ ├── BootstrapTextView.java │ │ │ ├── BorderView.java │ │ │ ├── ButtonModeView.java │ │ │ ├── OutlineableView.java │ │ │ ├── ProgressView.java │ │ │ └── RoundableView.java │ │ ├── font/ │ │ │ ├── AwesomeTypefaceSpan.java │ │ │ ├── FontAwesome.java │ │ │ ├── IconSet.java │ │ │ ├── MaterialIcons.java │ │ │ └── Typicon.java │ │ └── utils/ │ │ ├── ColorUtils.java │ │ ├── DimenUtils.java │ │ ├── DrawableUtils.java │ │ └── ViewUtils.java │ └── res/ │ └── values/ │ ├── attrs.xml │ ├── attrs_font_awesome.xml │ ├── attrs_materialIcon.xml │ ├── attrs_typicons.xml │ ├── colors.xml │ └── dimens.xml ├── LICENSE.txt ├── README.md ├── TODO.md ├── build.gradle ├── circle.yml ├── gradle/ │ └── wrapper/ │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradle.properties ├── gradlew ├── gradlew.bat ├── sample/ │ ├── .gitignore │ ├── build.gradle │ ├── proguard-rules.pro │ └── src/ │ └── main/ │ ├── AndroidManifest.xml │ ├── java/ │ │ └── com/ │ │ └── fractalwrench/ │ │ └── androidbootstrap/ │ │ └── sample/ │ │ ├── AwesomeTextViewExample.java │ │ ├── BaseActivity.java │ │ ├── BootstrapAlertExample.java │ │ ├── BootstrapBadgeExample.java │ │ ├── BootstrapButtonExample.java │ │ ├── BootstrapButtonGroupExample.java │ │ ├── BootstrapCircleThumbnailExample.java │ │ ├── BootstrapDropDownExample.java │ │ ├── BootstrapEditTextExample.java │ │ ├── BootstrapLabelExample.java │ │ ├── BootstrapProgressBarExample.java │ │ ├── BootstrapProgressBarGroupExample.java │ │ ├── BootstrapThumbnailExample.java │ │ ├── BootstrapWellExample.java │ │ ├── CustomBootstrapStyle.java │ │ ├── HomeActivity.java │ │ └── SampleApplication.java │ └── res/ │ ├── layout/ │ │ ├── activity_base.xml │ │ ├── activity_main.xml │ │ ├── example_awesome_text_view.xml │ │ ├── example_bootstrap_alert.xml │ │ ├── example_bootstrap_badge.xml │ │ ├── example_bootstrap_button.xml │ │ ├── example_bootstrap_button_group.xml │ │ ├── example_bootstrap_circle_thumbnail.xml │ │ ├── example_bootstrap_dropdown.xml │ │ ├── example_bootstrap_edit_text_view.xml │ │ ├── example_bootstrap_label.xml │ │ ├── example_bootstrap_progress_bar.xml │ │ ├── example_bootstrap_progress_bar_group.xml │ │ ├── example_bootstrap_thumbnail.xml │ │ └── example_bootstrap_well.xml │ └── values/ │ ├── colors.xml │ ├── dimens.xml │ ├── strings.xml │ └── styles.xml └── settings.gradle
SYMBOL INDEX (588 symbols across 64 files)
FILE: AndroidBootstrap/src/main/java/com/beardedhen/androidbootstrap/AwesomeTextView.java
class AwesomeTextView (line 33) | public class AwesomeTextView extends TextView implements BootstrapTextVi...
type AnimationSpeed (line 40) | public enum AnimationSpeed {
method AnimationSpeed (line 48) | AnimationSpeed(long rotateDuration, long flashDuration) {
method getRotateDuration (line 53) | public long getRotateDuration() {
method getFlashDuration (line 57) | public long getFlashDuration() {
method AwesomeTextView (line 62) | public AwesomeTextView(Context context) {
method AwesomeTextView (line 67) | public AwesomeTextView(Context context, AttributeSet attrs) {
method AwesomeTextView (line 72) | public AwesomeTextView(Context context, AttributeSet attrs, int defSty...
method initialise (line 77) | private void initialise(AttributeSet attrs) {
method onSaveInstanceState (line 130) | @Override public Parcelable onSaveInstanceState() {
method onRestoreInstanceState (line 138) | @Override public void onRestoreInstanceState(Parcelable state) {
method startFlashing (line 163) | public void startFlashing(boolean forever, AnimationSpeed speed) {
method startRotate (line 186) | public void startRotate(boolean clockwise, AnimationSpeed speed) {
method setIcon (line 212) | public void setIcon(CharSequence iconCode, IconSet iconSet) {
method setFontAwesomeIcon (line 222) | public void setFontAwesomeIcon(@FontAwesome.Icon CharSequence iconCode) {
method setMaterialIcon (line 232) | public void setMaterialIcon(@FontAwesome.Icon CharSequence iconCode) {
method setTypicon (line 242) | public void setTypicon(@Typicon.Icon CharSequence iconCode) {
method setMarkdownText (line 246) | @Override public void setMarkdownText(String text) {
method updateBootstrapState (line 250) | protected void updateBootstrapState() {
method setBootstrapText (line 263) | @Override public void setBootstrapText(BootstrapText bootstrapText) {
method getBootstrapText (line 268) | @Nullable @Override public BootstrapText getBootstrapText() {
method setBootstrapBrand (line 272) | @Override public void setBootstrapBrand(@NonNull BootstrapBrand bootst...
method getBootstrapBrand (line 277) | @NonNull @Override public BootstrapBrand getBootstrapBrand() {
method setText (line 281) | @Override public void setText(CharSequence text, BufferType type) {
method onTextChanged (line 286) | @Override
FILE: AndroidBootstrap/src/main/java/com/beardedhen/androidbootstrap/BootstrapAlert.java
class BootstrapAlert (line 31) | @BetaApi
type VisibilityChangeListener (line 37) | public interface VisibilityChangeListener{
method onAlertDismissStarted (line 43) | void onAlertDismissStarted(BootstrapAlert alert);
method onAlertDismissCompletion (line 49) | void onAlertDismissCompletion(BootstrapAlert alert);
method onAlertAppearStarted (line 55) | void onAlertAppearStarted(BootstrapAlert alert);
method onAlertAppearCompletion (line 61) | void onAlertAppearCompletion(BootstrapAlert alert);
method BootstrapAlert (line 83) | public BootstrapAlert(Context context) {
method BootstrapAlert (line 88) | public BootstrapAlert(Context context, AttributeSet attrs) {
method BootstrapAlert (line 93) | public BootstrapAlert(Context context, AttributeSet attrs, int defStyl...
method initialise (line 98) | private void initialise(AttributeSet attrs) {
method updateBootstrapState (line 129) | private void updateBootstrapState() {
method setupAnimations (line 202) | private void setupAnimations() {
method dismiss (line 218) | public void dismiss(boolean animated) {
method show (line 234) | public void show(boolean animated) {
method isUserDismissible (line 250) | public boolean isUserDismissible() {
method setUserDismissible (line 258) | public void setUserDismissible(boolean userDismissible) {
method setVisibilityChangeListener (line 268) | public void setVisibilityChangeListener(VisibilityChangeListener visib...
method generateViewUniqueId (line 272) | private int generateViewUniqueId() {
method setVisibility (line 286) | @Override
method onAnimationStart (line 302) | @Override
method onAnimationEnd (line 307) | @Override
method onAnimationRepeat (line 321) | @Override
FILE: AndroidBootstrap/src/main/java/com/beardedhen/androidbootstrap/BootstrapBadge.java
class BootstrapBadge (line 24) | @BetaApi
method BootstrapBadge (line 35) | public BootstrapBadge(Context context) {
method BootstrapBadge (line 40) | public BootstrapBadge(Context context, AttributeSet attrs) {
method BootstrapBadge (line 45) | public BootstrapBadge(Context context, AttributeSet attrs, int defStyl...
method init (line 50) | private void init(AttributeSet attrs) {
method updateBootstrapState (line 71) | private void updateBootstrapState() {
method getBadgeDrawable (line 81) | Drawable getBadgeDrawable() {
method getBadgeText (line 85) | @Override public String getBadgeText() {
method setBadgeText (line 89) | @Override public void setBadgeText(String badgeText) {
method setBootstrapBrand (line 94) | public void setBootstrapBrand(BootstrapBrand bootstrapBrand, boolean i...
method setBootstrapBrand (line 99) | @Override
method getBootstrapBrand (line 105) | @NonNull
method setBootstrapSize (line 111) | @Override
method setBootstrapSize (line 117) | @Override
method getBootstrapSize (line 123) | @Override
FILE: AndroidBootstrap/src/main/java/com/beardedhen/androidbootstrap/BootstrapBaseThumbnail.java
class BootstrapBaseThumbnail (line 35) | abstract class BootstrapBaseThumbnail extends ImageView implements Boots...
method BootstrapBaseThumbnail (line 52) | public BootstrapBaseThumbnail(Context context) {
method BootstrapBaseThumbnail (line 57) | public BootstrapBaseThumbnail(Context context, AttributeSet attrs) {
method BootstrapBaseThumbnail (line 62) | public BootstrapBaseThumbnail(Context context, AttributeSet attrs, int...
method initialise (line 67) | protected void initialise(AttributeSet attrs) {
method onSaveInstanceState (line 74) | @Override public Parcelable onSaveInstanceState() {
method onRestoreInstanceState (line 84) | @Override public void onRestoreInstanceState(Parcelable state) {
method setupPaints (line 102) | private void setupPaints() {
method onSizeChanged (line 117) | @Override protected void onSizeChanged(int w, int h, int oldw, int old...
method setScaleType (line 122) | @Override public void setScaleType(ScaleType scaleType) {
method getScaleType (line 131) | @Override public ScaleType getScaleType() {
method getBitmapForView (line 138) | @Nullable private Bitmap getBitmapForView() {
method setImageBitmap (line 162) | @Override public void setImageBitmap(Bitmap bm) {
method setImageDrawable (line 168) | @Override public void setImageDrawable(Drawable drawable) {
method setImageResource (line 174) | @Override public void setImageResource(int resId) {
method setImageURI (line 180) | @Override public void setImageURI(Uri uri) {
method updateImageState (line 189) | protected abstract void updateImageState();
method setBootstrapBrand (line 195) | @Override public void setBootstrapBrand(@NonNull BootstrapBrand bootst...
method getBootstrapBrand (line 200) | @NonNull @Override public BootstrapBrand getBootstrapBrand() {
method setBorderDisplayed (line 204) | @TargetApi(16) @Override public void setBorderDisplayed(boolean displa...
method isBorderDisplayed (line 209) | @Override public boolean isBorderDisplayed() {
method getBootstrapSize (line 213) | @Override public float getBootstrapSize() {
method setBootstrapSize (line 217) | @Override public void setBootstrapSize(float bootstrapSize) {
method setBootstrapSize (line 222) | @Override public void setBootstrapSize(DefaultBootstrapSize bootstrapS...
FILE: AndroidBootstrap/src/main/java/com/beardedhen/androidbootstrap/BootstrapButton.java
class BootstrapButton (line 34) | public class BootstrapButton extends AwesomeTextView implements Bootstra...
type OnCheckedChangedListener (line 42) | public interface OnCheckedChangedListener{
method OnCheckedChanged (line 48) | public void OnCheckedChanged(BootstrapButton bootstrapButton, boolea...
method BootstrapButton (line 75) | public BootstrapButton(Context context) {
method BootstrapButton (line 80) | public BootstrapButton(Context context, AttributeSet attrs) {
method BootstrapButton (line 85) | public BootstrapButton(Context context, AttributeSet attrs, int defSty...
method initialise (line 90) | private void initialise(AttributeSet attrs) {
method onSaveInstanceState (line 124) | @Override public Parcelable onSaveInstanceState() {
method onRestoreInstanceState (line 141) | @Override public void onRestoreInstanceState(Parcelable state) {
method updateBootstrapState (line 163) | @Override protected void updateBootstrapState() {
method onTouchEvent (line 197) | @Override public boolean onTouchEvent(@NonNull MotionEvent event) {
method setSelected (line 212) | @Override
method handleRadioEvent (line 220) | private boolean handleRadioEvent(@NonNull MotionEvent event) {
method handleToggle (line 236) | private boolean handleToggle(@NonNull MotionEvent event) {
method setViewGroupPosition (line 252) | void setViewGroupPosition(ViewGroupPosition viewGroupPosition, int par...
method updateFromParent (line 258) | void updateFromParent(BootstrapBrand bootstrapBrand,
method displayBadgeDrawable (line 274) | @Override public void displayBadgeDrawable() {
method isMustBeSelected (line 292) | public boolean isMustBeSelected() {
method setChecked (line 296) | public void setChecked(boolean checked) {
method isShowOutline (line 300) | @Override public boolean isShowOutline() {
method isRounded (line 304) | @Override public boolean isRounded() {
method setShowOutline (line 308) | @Override public void setShowOutline(boolean showOutline) {
method setRounded (line 313) | @Override public void setRounded(boolean rounded) {
method getButtonMode (line 318) | @NonNull @Override public ButtonMode getButtonMode() {
method setButtonMode (line 322) | @Override public void setButtonMode(@NonNull ButtonMode buttonMode) {
method setBadge (line 326) | @Override public void setBadge(BootstrapBadge badge) {
method getBadgeText (line 333) | @Nullable
method setBadgeText (line 339) | @Override
method getBootstrapSize (line 348) | @Override public float getBootstrapSize() {
method getBootstrapBadge (line 352) | @Override public BootstrapBadge getBootstrapBadge() {
method setBootstrapSize (line 356) | @Override public void setBootstrapSize(DefaultBootstrapSize bootstrapS...
method setBootstrapSize (line 360) | @Override public void setBootstrapSize(float bootstrapSize) {
method setOnCheckedChangedListener (line 370) | public void setOnCheckedChangedListener(OnCheckedChangedListener liste...
method setOnClickListener (line 379) | @Override
FILE: AndroidBootstrap/src/main/java/com/beardedhen/androidbootstrap/BootstrapButtonGroup.java
class BootstrapButtonGroup (line 42) | public class BootstrapButtonGroup extends BootstrapGroup implements Boot...
method BootstrapButtonGroup (line 57) | public BootstrapButtonGroup(Context context) {
method BootstrapButtonGroup (line 62) | public BootstrapButtonGroup(Context context, AttributeSet attrs) {
method BootstrapButtonGroup (line 67) | public BootstrapButtonGroup(Context context, AttributeSet attrs, int d...
method initialise (line 72) | protected void initialise(AttributeSet attrs) {
method onSaveInstanceState (line 94) | @Override public Parcelable onSaveInstanceState() {
method onRestoreInstanceState (line 107) | @Override public void onRestoreInstanceState(Parcelable state) {
method onBootstrapViewAdded (line 130) | @Override
method onBootstrapViewRemoved (line 135) | @Override
method updateBootstrapGroup (line 140) | protected void updateBootstrapGroup() {
method retrieveButtonChild (line 192) | private BootstrapButton retrieveButtonChild(int i) {
method onRadioToggle (line 209) | void onRadioToggle(int index) {
method check (line 223) | public void check(@IdRes int id) {
method getBootstrapSize (line 227) | @Override public float getBootstrapSize() {
method setBootstrapSize (line 231) | @Override public void setBootstrapSize(DefaultBootstrapSize bootstrapS...
method setBootstrapSize (line 235) | @Override public void setBootstrapSize(float bootstrapSize) {
method getButtonMode (line 244) | @NonNull public ButtonMode getButtonMode() {
method setButtonMode (line 248) | public void setButtonMode(@NonNull ButtonMode buttonMode) {
method setBootstrapBrand (line 257) | @Override public void setBootstrapBrand(@NonNull BootstrapBrand bootst...
method getBootstrapBrand (line 266) | @NonNull @Override public BootstrapBrand getBootstrapBrand() {
method setShowOutline (line 270) | @Override public void setShowOutline(boolean showOutline) {
method isShowOutline (line 279) | @Override public boolean isShowOutline() {
method setRounded (line 283) | @Override public void setRounded(boolean rounded) {
method isRounded (line 292) | @Override public boolean isRounded() {
FILE: AndroidBootstrap/src/main/java/com/beardedhen/androidbootstrap/BootstrapCircleThumbnail.java
class BootstrapCircleThumbnail (line 26) | public class BootstrapCircleThumbnail extends BootstrapBaseThumbnail {
method BootstrapCircleThumbnail (line 33) | public BootstrapCircleThumbnail(Context context) {
method BootstrapCircleThumbnail (line 38) | public BootstrapCircleThumbnail(Context context, AttributeSet attrs) {
method BootstrapCircleThumbnail (line 43) | public BootstrapCircleThumbnail(Context context, AttributeSet attrs, i...
method initialise (line 48) | protected void initialise(AttributeSet attrs) {
method updateImageState (line 81) | protected void updateImageState() {
method onDraw (line 123) | @Override protected void onDraw(@NonNull Canvas canvas) {
method onMeasure (line 145) | @Override protected void onMeasure(int widthMeasureSpec, int heightMea...
method updateBackground (line 169) | private void updateBackground() {
FILE: AndroidBootstrap/src/main/java/com/beardedhen/androidbootstrap/BootstrapDrawableFactory.java
class BootstrapDrawableFactory (line 31) | class BootstrapDrawableFactory {
method bootstrapButton (line 45) | static Drawable bootstrapButton(Context context,
method bootstrapLabel (line 90) | static Drawable bootstrapLabel(Context context,
method bootstrapEditText (line 113) | static Drawable bootstrapEditText(Context context,
method bootstrapCircleThumbnail (line 150) | static Drawable bootstrapCircleThumbnail(Context context,
method bootstrapThumbnail (line 162) | static Drawable bootstrapThumbnail(Context context,
method bootstrapAlert (line 182) | static Drawable bootstrapAlert(Context context,
method bootstrapButtonText (line 204) | static ColorStateList bootstrapButtonText(Context context, boolean out...
method bootstrapWell (line 221) | static Drawable bootstrapWell(@ColorInt int backgroundColor, int corne...
method setupStateDrawable (line 229) | private static StateListDrawable setupStateDrawable(ViewGroupPosition ...
method setupDrawableCorners (line 269) | private static void setupDrawableCorners(ViewGroupPosition position, b...
method getStateList (line 311) | private static int[][] getStateList() {
method getColorList (line 328) | private static int[] getColorList(int defaultColor, int activeColor, i...
method bootstrapDropDownArrow (line 339) | static StateListDrawable bootstrapDropDownArrow(Context context, int w...
method bootstrapAlertCloseIcon (line 359) | static StateListDrawable bootstrapAlertCloseIcon(Context context, int ...
method createArrowIcon (line 390) | private static Drawable createArrowIcon(Context context, int width, in...
method createCloseCrossIcon (line 419) | private static Drawable createCloseCrossIcon(Context context, int widt...
method createBadgeDrawable (line 438) | public static Drawable createBadgeDrawable(Context context, BootstrapB...
method bootstrapDropDownViewText (line 490) | static ColorStateList bootstrapDropDownViewText(Context context) {
method setInsetOnLayers (line 499) | private static void setInsetOnLayers(LayerDrawable[] ary, int l, int t...
FILE: AndroidBootstrap/src/main/java/com/beardedhen/androidbootstrap/BootstrapDropDown.java
class BootstrapDropDown (line 42) | @BetaApi
method BootstrapDropDown (line 80) | public BootstrapDropDown(Context context) {
method BootstrapDropDown (line 85) | public BootstrapDropDown(Context context, AttributeSet attrs) {
method BootstrapDropDown (line 90) | public BootstrapDropDown(Context context, AttributeSet attrs, int defS...
method initialise (line 95) | private void initialise(AttributeSet attrs) {
method createDropDown (line 144) | private void createDropDown() {
method createDropDownView (line 169) | private ScrollView createDropDownView() {
method updateDropDownState (line 240) | private void updateDropDownState() {
method measureStringWidth (line 291) | private float measureStringWidth(String text) {
method getLongestString (line 304) | private String getLongestString(String[] array) {
method cleanData (line 316) | private void cleanData() {
method setOnDropDownItemClickListener (line 331) | public void setOnDropDownItemClickListener(OnDropDownItemClickListener...
method isShowOutline (line 335) | @Override public boolean isShowOutline() {
method isRounded (line 339) | @Override public boolean isRounded() {
method getExpandDirection (line 348) | public ExpandDirection getExpandDirection() {
method getDropdownData (line 357) | public String[] getDropdownData() {
method setShowOutline (line 361) | @Override public void setShowOutline(boolean showOutline) {
method setRounded (line 366) | @Override public void setRounded(boolean rounded) {
method setExpandDirection (line 376) | public void setExpandDirection(ExpandDirection expandDirection) {
method setDropdownData (line 386) | public void setDropdownData(String[] dropdownData) {
method onDismiss (line 392) | @Override public void onDismiss() {
method onClick (line 397) | @Override public void onClick(View v) {
method onSaveInstanceState (line 432) | @Override public Parcelable onSaveInstanceState() {
method onRestoreInstanceState (line 444) | @Override public void onRestoreInstanceState(Parcelable state) {
method setOnClickListener (line 461) | @Override public void setOnClickListener(OnClickListener clickListener) {
type OnDropDownItemClickListener (line 468) | public interface OnDropDownItemClickListener {
method onItemClick (line 477) | void onItemClick(ViewGroup parent, View v, int id);
class DividerView (line 480) | private static class DividerView extends TextView {
method DividerView (line 484) | public DividerView(Context context) {
method onDraw (line 490) | @Override protected void onDraw(Canvas canvas) {
FILE: AndroidBootstrap/src/main/java/com/beardedhen/androidbootstrap/BootstrapEditText.java
class BootstrapEditText (line 28) | public class BootstrapEditText extends EditText implements BootstrapBran...
method BootstrapEditText (line 43) | public BootstrapEditText(Context context) {
method BootstrapEditText (line 48) | public BootstrapEditText(Context context, AttributeSet attrs) {
method BootstrapEditText (line 53) | public BootstrapEditText(Context context, AttributeSet attrs, int defS...
method initialise (line 58) | private void initialise(AttributeSet attrs) {
method onSaveInstanceState (line 90) | @Override public Parcelable onSaveInstanceState() {
method onRestoreInstanceState (line 99) | @Override public void onRestoreInstanceState(Parcelable state) {
method updateBootstrapState (line 116) | private void updateBootstrapState() {
method setBootstrapBrand (line 141) | @Override public void setBootstrapBrand(@NonNull BootstrapBrand bootst...
method getBootstrapBrand (line 146) | @NonNull @Override public BootstrapBrand getBootstrapBrand() {
method setRounded (line 150) | @Override public void setRounded(boolean rounded) {
method isRounded (line 155) | @Override public boolean isRounded() {
method getBootstrapSize (line 159) | @Override public float getBootstrapSize() {
method setBootstrapSize (line 163) | @Override public void setBootstrapSize(float bootstrapSize) {
method setBootstrapSize (line 168) | @Override public void setBootstrapSize(DefaultBootstrapSize bootstrapS...
FILE: AndroidBootstrap/src/main/java/com/beardedhen/androidbootstrap/BootstrapGroup.java
class BootstrapGroup (line 15) | abstract class BootstrapGroup extends LinearLayout {
method BootstrapGroup (line 17) | public BootstrapGroup(Context context) {
method BootstrapGroup (line 22) | public BootstrapGroup(Context context, AttributeSet attrs) {
method BootstrapGroup (line 27) | public BootstrapGroup(Context context, AttributeSet attrs, int defStyl...
method initialise (line 32) | protected abstract void initialise(AttributeSet attrs);
method setOrientation (line 34) | @Override public void setOrientation(int orientation) {
method updateBootstrapGroup (line 39) | protected abstract void updateBootstrapGroup();
method onBootstrapViewAdded (line 42) | protected abstract void onBootstrapViewAdded();
method onBootstrapViewRemoved (line 43) | protected abstract void onBootstrapViewRemoved();
method addView (line 45) | @Override
method removeAllViews (line 51) | @Override
method removeView (line 57) | @Override
method removeViewInLayout (line 63) | @Override
method removeViewsInLayout (line 69) | @Override
method removeViewAt (line 75) | @Override
method removeViews (line 82) | @Override
FILE: AndroidBootstrap/src/main/java/com/beardedhen/androidbootstrap/BootstrapLabel.java
class BootstrapLabel (line 25) | public class BootstrapLabel extends AwesomeTextView implements Roundable...
method BootstrapLabel (line 32) | public BootstrapLabel(Context context) {
method BootstrapLabel (line 37) | public BootstrapLabel(Context context, AttributeSet attrs) {
method BootstrapLabel (line 42) | public BootstrapLabel(Context context, AttributeSet attrs, int defStyl...
method initialise (line 47) | private void initialise(AttributeSet attrs) {
method onSaveInstanceState (line 62) | @Override public Parcelable onSaveInstanceState() {
method onRestoreInstanceState (line 70) | @Override public void onRestoreInstanceState(Parcelable state) {
method updateBootstrapState (line 87) | @Override public void updateBootstrapState() {
method onSizeChanged (line 111) | @Override protected void onSizeChanged(int w, int h, int oldw, int old...
method setRounded (line 123) | @Override public void setRounded(boolean rounded) {
method isRounded (line 128) | @Override public boolean isRounded() {
method setBootstrapHeading (line 132) | @Override public void setBootstrapHeading(@NonNull BootstrapHeading bo...
method getBootstrapHeading (line 137) | @NonNull @Override public BootstrapHeading getBootstrapHeading() {
FILE: AndroidBootstrap/src/main/java/com/beardedhen/androidbootstrap/BootstrapProgressBar.java
class BootstrapProgressBar (line 47) | public class BootstrapProgressBar extends View implements ProgressView, ...
method BootstrapProgressBar (line 87) | public BootstrapProgressBar(Context context) {
method BootstrapProgressBar (line 92) | public BootstrapProgressBar(Context context, AttributeSet attrs) {
method BootstrapProgressBar (line 97) | public BootstrapProgressBar(Context context, AttributeSet attrs, int d...
method initialise (line 102) | private void initialise(AttributeSet attrs) {
method onSaveInstanceState (line 152) | @Override
method onRestoreInstanceState (line 167) | @Override
method getStripeColor (line 192) | private int getStripeColor(@ColorInt int color) {
method startProgressUpdateAnimation (line 206) | private void startProgressUpdateAnimation() {
method onAnimationUpdate (line 222) | @Override
method onAnimationStart (line 228) | @Override
method onAnimationEnd (line 232) | @Override
method onAnimationCancel (line 237) | @Override
method onAnimationRepeat (line 241) | @Override
method startStripedAnimationIfNeeded (line 250) | private void startStripedAnimationIfNeeded() {
method onMeasure (line 276) | @Override
method onSizeChanged (line 299) | @Override
method onDraw (line 308) | @Override
method createTile (line 374) | private static Bitmap createTile(float h, Paint stripePaint, Paint pro...
method createRoundedBitmap (line 413) | private static Bitmap createRoundedBitmap(Bitmap bitmap, float cornerR...
method updateBootstrapState (line 448) | private void updateBootstrapState() {
method invalidateDrawCache (line 456) | private void invalidateDrawCache() {
method setProgress (line 467) | @SuppressLint("DefaultLocale")
method getProgress (line 499) | @Override
method setStriped (line 504) | @Override
method isStriped (line 511) | @Override
method setAnimated (line 516) | @Override
method isAnimated (line 523) | @Override
method setBootstrapBrand (line 528) | @Override
method getBootstrapBrand (line 535) | @NonNull
method setRounded (line 541) | @Override
method isRounded (line 547) | @Override
method getBootstrapSize (line 552) | @Override
method setBootstrapSize (line 557) | @Override
method setBootstrapSize (line 565) | @Override
method getMaxProgress (line 574) | public int getMaxProgress() {
method setMaxProgress (line 582) | public void setMaxProgress(int newMaxProgress) {
method setCornerRounding (line 594) | void setCornerRounding(boolean left, boolean right){
method getCornerRoundingLeft (line 599) | boolean getCornerRoundingLeft(){
method getCornerRoundingRight (line 603) | boolean getCornerRoundingRight(){
FILE: AndroidBootstrap/src/main/java/com/beardedhen/androidbootstrap/BootstrapProgressBarGroup.java
class BootstrapProgressBarGroup (line 20) | public class BootstrapProgressBarGroup extends BootstrapGroup implements...
method BootstrapProgressBarGroup (line 33) | public BootstrapProgressBarGroup(Context context) {
method BootstrapProgressBarGroup (line 38) | public BootstrapProgressBarGroup(Context context, AttributeSet attrs) {
method BootstrapProgressBarGroup (line 43) | public BootstrapProgressBarGroup(Context context, AttributeSet attrs, ...
method initialise (line 48) | protected void initialise(AttributeSet attrs) {
method onBootstrapViewAdded (line 63) | @Override
method onBootstrapViewRemoved (line 70) | @Override
method addEmptyProgressBar (line 80) | private void addEmptyProgressBar(){
method updateBootstrapGroup (line 101) | @Override
method getDefultlayoutParams (line 135) | private LinearLayout.LayoutParams getDefultlayoutParams(){
method getCumulativeProgress (line 146) | public int getCumulativeProgress(){
method checkCumulativeSmallerThanMax (line 156) | private void checkCumulativeSmallerThanMax(int max, int cumulative){
method getChildProgress (line 173) | private int getChildProgress(int i){
method retrieveChild (line 177) | private BootstrapProgressBar retrieveChild(int i) {
method onProgressChanged (line 192) | public void onProgressChanged(BootstrapProgressBar bootstrapProgressBar){
method getMaxProgress (line 200) | public int getMaxProgress(){
method setMaxProgress (line 208) | public void setMaxProgress(int maxProgress){
method setRounded (line 217) | @Override
method isRounded (line 227) | @Override
method setProgress (line 232) | @Override
method getProgress (line 237) | @Override
method setStriped (line 246) | @Override
method isStriped (line 258) | @Override
method setAnimated (line 268) | @Override
method isAnimated (line 280) | @Override
FILE: AndroidBootstrap/src/main/java/com/beardedhen/androidbootstrap/BootstrapText.java
class BootstrapText (line 21) | public class BootstrapText extends SpannableString implements Serializab...
method BootstrapText (line 23) | private BootstrapText(CharSequence source) {
class Builder (line 31) | public static class Builder {
method Builder (line 38) | public Builder(Context context) {
method Builder (line 45) | public Builder(Context context, boolean editMode) {
method addText (line 58) | public Builder addText(CharSequence text) {
method addFontAwesomeIcon (line 68) | public Builder addFontAwesomeIcon(@FontAwesome.Icon CharSequence ico...
method addTypicon (line 80) | public Builder addTypicon(@Typicon.Icon CharSequence iconCode) {
method addMaterialIcon (line 92) | public Builder addMaterialIcon( CharSequence iconCode) {
method addIcon (line 105) | public Builder addIcon(CharSequence iconCode, IconSet iconSet) {
method build (line 114) | public BootstrapText build() {
FILE: AndroidBootstrap/src/main/java/com/beardedhen/androidbootstrap/BootstrapThumbnail.java
class BootstrapThumbnail (line 25) | public class BootstrapThumbnail extends BootstrapBaseThumbnail implement...
method BootstrapThumbnail (line 35) | public BootstrapThumbnail(Context context) {
method BootstrapThumbnail (line 40) | public BootstrapThumbnail(Context context, AttributeSet attrs) {
method BootstrapThumbnail (line 45) | public BootstrapThumbnail(Context context, AttributeSet attrs, int def...
method onSaveInstanceState (line 50) | @Override public Parcelable onSaveInstanceState() {
method onRestoreInstanceState (line 57) | @Override public void onRestoreInstanceState(Parcelable state) {
method initialise (line 66) | protected void initialise(AttributeSet attrs) {
method updateImageState (line 99) | protected void updateImageState() {
method updateBackground (line 105) | private void updateBackground() {
method updatePadding (line 119) | private void updatePadding() {
method onDraw (line 127) | @Override protected void onDraw(Canvas canvas) {
method setRounded (line 156) | @Override public void setRounded(boolean rounded) {
method isRounded (line 161) | @Override public boolean isRounded() {
FILE: AndroidBootstrap/src/main/java/com/beardedhen/androidbootstrap/BootstrapWell.java
class BootstrapWell (line 17) | public class BootstrapWell extends FrameLayout {
method BootstrapWell (line 21) | public BootstrapWell(Context context) {
method BootstrapWell (line 26) | public BootstrapWell(Context context, AttributeSet attrs) {
method BootstrapWell (line 31) | public BootstrapWell(Context context, AttributeSet attrs, int defStyle...
method initialise (line 36) | private void initialise(AttributeSet attrs) {
method updateBootstrapState (line 49) | private void updateBootstrapState() {
FILE: AndroidBootstrap/src/main/java/com/beardedhen/androidbootstrap/IconResolver.java
class IconResolver (line 16) | class IconResolver {
method resolveMarkdown (line 31) | static BootstrapText resolveMarkdown(Context context, String markdown,...
method resolveIconSet (line 112) | private static IconSet resolveIconSet(String iconCode) {
FILE: AndroidBootstrap/src/main/java/com/beardedhen/androidbootstrap/TypefaceProvider.java
class TypefaceProvider (line 19) | public class TypefaceProvider {
method getTypeface (line 31) | public static Typeface getTypeface(Context context, IconSet iconSet) {
method registerDefaultIconSets (line 45) | public static void registerDefaultIconSets() {
method registerCustomIconSet (line 60) | public static void registerCustomIconSet(IconSet iconSet) {
method retrieveRegisteredIconSet (line 71) | public static IconSet retrieveRegisteredIconSet(String fontPath, boole...
method getRegisteredIconSets (line 86) | public static Collection<IconSet> getRegisteredIconSets() {
FILE: AndroidBootstrap/src/main/java/com/beardedhen/androidbootstrap/api/attributes/BootstrapBrand.java
type BootstrapBrand (line 12) | public interface BootstrapBrand extends Serializable {
method defaultFill (line 22) | @ColorInt int defaultFill(Context context);
method defaultEdge (line 30) | @ColorInt int defaultEdge(Context context);
method defaultTextColor (line 38) | @ColorInt int defaultTextColor(Context context);
method activeFill (line 46) | @ColorInt int activeFill(Context context);
method activeEdge (line 54) | @ColorInt int activeEdge(Context context);
method activeTextColor (line 62) | @ColorInt int activeTextColor(Context context);
method disabledFill (line 70) | @ColorInt int disabledFill(Context context);
method disabledEdge (line 78) | @ColorInt int disabledEdge(Context context);
method disabledTextColor (line 86) | @ColorInt int disabledTextColor(Context context);
method getColor (line 88) | @ColorInt int getColor();
FILE: AndroidBootstrap/src/main/java/com/beardedhen/androidbootstrap/api/attributes/BootstrapHeading.java
type BootstrapHeading (line 11) | public interface BootstrapHeading extends Serializable {
method getTextSize (line 21) | float getTextSize(Context context);
method verticalPadding (line 29) | float verticalPadding(Context context);
method horizontalPadding (line 37) | float horizontalPadding(Context context);
FILE: AndroidBootstrap/src/main/java/com/beardedhen/androidbootstrap/api/attributes/ViewGroupPosition.java
type ViewGroupPosition (line 3) | public enum ViewGroupPosition {
FILE: AndroidBootstrap/src/main/java/com/beardedhen/androidbootstrap/api/defaults/ButtonMode.java
type ButtonMode (line 3) | public enum ButtonMode {
method fromAttributeValue (line 9) | public static ButtonMode fromAttributeValue(int attrValue) {
FILE: AndroidBootstrap/src/main/java/com/beardedhen/androidbootstrap/api/defaults/DefaultBootstrapBrand.java
type DefaultBootstrapBrand (line 21) | public enum DefaultBootstrapBrand implements BootstrapBrand {
method DefaultBootstrapBrand (line 34) | DefaultBootstrapBrand(int color) {
method DefaultBootstrapBrand (line 39) | DefaultBootstrapBrand(int color, int textColor) {
method fromAttributeValue (line 44) | public static DefaultBootstrapBrand fromAttributeValue(int attrValue) {
method defaultFill (line 65) | @ColorInt public int defaultFill(Context context) {
method defaultEdge (line 69) | @ColorInt public int defaultEdge(Context context) {
method activeFill (line 73) | @ColorInt public int activeFill(Context context) {
method activeEdge (line 77) | @ColorInt public int activeEdge(Context context) {
method disabledFill (line 81) | @ColorInt public int disabledFill(Context context) {
method disabledEdge (line 85) | @ColorInt public int disabledEdge(Context context) {
method defaultTextColor (line 89) | @ColorInt public int defaultTextColor(Context context) {
method activeTextColor (line 93) | @ColorInt public int activeTextColor(Context context) {
method disabledTextColor (line 97) | @ColorInt public int disabledTextColor(Context context) {
method getColor (line 101) | @ColorInt public int getColor() {
FILE: AndroidBootstrap/src/main/java/com/beardedhen/androidbootstrap/api/defaults/DefaultBootstrapHeading.java
type DefaultBootstrapHeading (line 14) | public enum DefaultBootstrapHeading implements BootstrapHeading {
method DefaultBootstrapHeading (line 44) | DefaultBootstrapHeading(int textSize, int vertPadding, int horiPadding) {
method fromAttributeValue (line 50) | public static DefaultBootstrapHeading fromAttributeValue(int attrValue) {
method getTextSize (line 69) | @Override public float getTextSize(Context context) {
method verticalPadding (line 73) | @Override public float verticalPadding(Context context) {
method horizontalPadding (line 77) | @Override public float horizontalPadding(Context context) {
FILE: AndroidBootstrap/src/main/java/com/beardedhen/androidbootstrap/api/defaults/DefaultBootstrapSize.java
type DefaultBootstrapSize (line 7) | public enum DefaultBootstrapSize {
method fromAttributeValue (line 15) | public static DefaultBootstrapSize fromAttributeValue(int attrValue) {
method scaleFactor (line 32) | public float scaleFactor() {
FILE: AndroidBootstrap/src/main/java/com/beardedhen/androidbootstrap/api/defaults/ExpandDirection.java
type ExpandDirection (line 4) | public enum ExpandDirection {
method fromAttributeValue (line 8) | public static ExpandDirection fromAttributeValue(int attrValue) {
FILE: AndroidBootstrap/src/main/java/com/beardedhen/androidbootstrap/api/view/BadgeContainerView.java
type BadgeContainerView (line 9) | public interface BadgeContainerView extends BootstrapBadgeView {
method setBadge (line 18) | void setBadge(BootstrapBadge badge);
method getBootstrapBadge (line 25) | BootstrapBadge getBootstrapBadge();
method displayBadgeDrawable (line 31) | void displayBadgeDrawable();
FILE: AndroidBootstrap/src/main/java/com/beardedhen/androidbootstrap/api/view/BootstrapBadgeView.java
type BootstrapBadgeView (line 5) | public interface BootstrapBadgeView {
method getBadgeText (line 12) | @Nullable
method setBadgeText (line 20) | void setBadgeText(@Nullable String badgeText);
FILE: AndroidBootstrap/src/main/java/com/beardedhen/androidbootstrap/api/view/BootstrapBrandView.java
type BootstrapBrandView (line 10) | public interface BootstrapBrandView {
method setBootstrapBrand (line 19) | void setBootstrapBrand(@NonNull BootstrapBrand bootstrapBrand);
method getBootstrapBrand (line 24) | @NonNull BootstrapBrand getBootstrapBrand();
FILE: AndroidBootstrap/src/main/java/com/beardedhen/androidbootstrap/api/view/BootstrapHeadingView.java
type BootstrapHeadingView (line 11) | public interface BootstrapHeadingView {
method setBootstrapHeading (line 20) | void setBootstrapHeading(@NonNull BootstrapHeading bootstrapHeading);
method getBootstrapHeading (line 25) | @NonNull BootstrapHeading getBootstrapHeading();
FILE: AndroidBootstrap/src/main/java/com/beardedhen/androidbootstrap/api/view/BootstrapSizeView.java
type BootstrapSizeView (line 9) | public interface BootstrapSizeView {
method getBootstrapSize (line 20) | float getBootstrapSize();
method setBootstrapSize (line 29) | void setBootstrapSize(float bootstrapSize);
method setBootstrapSize (line 36) | void setBootstrapSize(DefaultBootstrapSize bootstrapSize);
FILE: AndroidBootstrap/src/main/java/com/beardedhen/androidbootstrap/api/view/BootstrapTextView.java
type BootstrapTextView (line 10) | public interface BootstrapTextView {
method setBootstrapText (line 19) | void setBootstrapText(@Nullable BootstrapText bootstrapText);
method getBootstrapText (line 24) | @Nullable BootstrapText getBootstrapText();
method setMarkdownText (line 32) | void setMarkdownText(@Nullable String text);
FILE: AndroidBootstrap/src/main/java/com/beardedhen/androidbootstrap/api/view/BorderView.java
type BorderView (line 6) | public interface BorderView {
method setBorderDisplayed (line 15) | void setBorderDisplayed(boolean displayed);
method isBorderDisplayed (line 20) | boolean isBorderDisplayed();
FILE: AndroidBootstrap/src/main/java/com/beardedhen/androidbootstrap/api/view/ButtonModeView.java
type ButtonModeView (line 10) | public interface ButtonModeView {
method getButtonMode (line 15) | @NonNull ButtonMode getButtonMode();
method setButtonMode (line 22) | void setButtonMode(@NonNull ButtonMode buttonMode);
FILE: AndroidBootstrap/src/main/java/com/beardedhen/androidbootstrap/api/view/OutlineableView.java
type OutlineableView (line 7) | public interface OutlineableView {
method setShowOutline (line 16) | void setShowOutline(boolean showOutline);
method isShowOutline (line 21) | boolean isShowOutline();
FILE: AndroidBootstrap/src/main/java/com/beardedhen/androidbootstrap/api/view/ProgressView.java
type ProgressView (line 6) | public interface ProgressView {
method setProgress (line 18) | void setProgress(int progress);
method getProgress (line 23) | int getProgress();
method setStriped (line 30) | void setStriped(boolean striped);
method isStriped (line 35) | boolean isStriped();
method setAnimated (line 44) | void setAnimated(boolean animated);
method isAnimated (line 49) | boolean isAnimated();
method getMaxProgress (line 54) | int getMaxProgress();
method setMaxProgress (line 62) | void setMaxProgress(int maxProgress);
FILE: AndroidBootstrap/src/main/java/com/beardedhen/androidbootstrap/api/view/RoundableView.java
type RoundableView (line 7) | public interface RoundableView {
method setRounded (line 16) | void setRounded(boolean rounded);
method isRounded (line 21) | boolean isRounded();
FILE: AndroidBootstrap/src/main/java/com/beardedhen/androidbootstrap/font/AwesomeTypefaceSpan.java
class AwesomeTypefaceSpan (line 13) | public class AwesomeTypefaceSpan extends TypefaceSpan {
method AwesomeTypefaceSpan (line 18) | public AwesomeTypefaceSpan(Context context, IconSet iconSet) {
method updateDrawState (line 24) | @Override public void updateDrawState(@NonNull TextPaint ds) {
method updateMeasureState (line 28) | @Override public void updateMeasureState(@NonNull TextPaint paint) {
FILE: AndroidBootstrap/src/main/java/com/beardedhen/androidbootstrap/font/FontAwesome.java
class FontAwesome (line 17) | public class FontAwesome implements IconSet {
method unicodeForKey (line 21) | @Override public CharSequence unicodeForKey(@Icon CharSequence key) {
method iconCodeForAttrIndex (line 25) | @Override public CharSequence iconCodeForAttrIndex(int index) {
method fontPath (line 29) | @Override public CharSequence fontPath() {
FILE: AndroidBootstrap/src/main/java/com/beardedhen/androidbootstrap/font/IconSet.java
type IconSet (line 7) | public interface IconSet {
method unicodeForKey (line 14) | CharSequence unicodeForKey(CharSequence key);
method iconCodeForAttrIndex (line 22) | CharSequence iconCodeForAttrIndex(int index);
method fontPath (line 30) | CharSequence fontPath();
FILE: AndroidBootstrap/src/main/java/com/beardedhen/androidbootstrap/font/MaterialIcons.java
class MaterialIcons (line 14) | public class MaterialIcons implements IconSet {
method unicodeForKey (line 23) | @Override
method iconCodeForAttrIndex (line 28) | @Override
method fontPath (line 33) | @Override
FILE: AndroidBootstrap/src/main/java/com/beardedhen/androidbootstrap/font/Typicon.java
class Typicon (line 16) | public class Typicon implements IconSet {
method unicodeForKey (line 23) | @Override public CharSequence unicodeForKey(@Icon CharSequence key) {
method iconCodeForAttrIndex (line 27) | @Override public CharSequence iconCodeForAttrIndex(int index) {
method fontPath (line 31) | @Override public CharSequence fontPath() {
FILE: AndroidBootstrap/src/main/java/com/beardedhen/androidbootstrap/utils/ColorUtils.java
class ColorUtils (line 12) | public class ColorUtils {
method resolveColor (line 26) | @SuppressWarnings("deprecation")
method decreaseRgbChannels (line 44) | @ColorInt public static int decreaseRgbChannels(Context context,
method increaseOpacity (line 72) | @ColorInt public static int increaseOpacity(Context context, @ColorRes...
method increaseOpacityFromInt (line 77) | @ColorInt public static int increaseOpacityFromInt(Context context, @C...
FILE: AndroidBootstrap/src/main/java/com/beardedhen/androidbootstrap/utils/DimenUtils.java
class DimenUtils (line 10) | public class DimenUtils {
method pixelsFromSpResource (line 19) | public static float pixelsFromSpResource(Context context, @DimenRes in...
method pixelsFromDpResource (line 31) | public static float pixelsFromDpResource(Context context, @DimenRes in...
method dpToPixels (line 40) | public static int dpToPixels(float dip) {
method pixelsToDp (line 49) | public static int pixelsToDp(float pixels) {
FILE: AndroidBootstrap/src/main/java/com/beardedhen/androidbootstrap/utils/DrawableUtils.java
class DrawableUtils (line 9) | public class DrawableUtils {
method resolveDrawable (line 11) | @SuppressWarnings("deprecation")
FILE: AndroidBootstrap/src/main/java/com/beardedhen/androidbootstrap/utils/ViewUtils.java
class ViewUtils (line 7) | public class ViewUtils {
method setBackgroundDrawable (line 16) | @SuppressWarnings("deprecation")
FILE: sample/src/main/java/com/fractalwrench/androidbootstrap/sample/AwesomeTextViewExample.java
class AwesomeTextViewExample (line 19) | public class AwesomeTextViewExample extends BaseActivity {
method getContentLayoutId (line 21) | @Override protected int getContentLayoutId() {
method onCreate (line 35) | @Override protected void onCreate(Bundle savedInstanceState) {
method setupFontAwesomeText (line 40) | private void setupFontAwesomeText() {
method onChangeClicked (line 60) | @OnClick(R.id.example_fa_text_change) void onChangeClicked() {
method onMultiChangeClicked (line 65) | @OnClick(R.id.example_fa_text_multi_change) void onMultiChangeClicked() {
FILE: sample/src/main/java/com/fractalwrench/androidbootstrap/sample/BaseActivity.java
class BaseActivity (line 14) | abstract class BaseActivity extends AppCompatActivity {
method getContentLayoutId (line 16) | @LayoutRes protected abstract int getContentLayoutId();
method onCreate (line 18) | @Override protected void onCreate(Bundle savedInstanceState) {
FILE: sample/src/main/java/com/fractalwrench/androidbootstrap/sample/BootstrapAlertExample.java
class BootstrapAlertExample (line 12) | public class BootstrapAlertExample extends BaseActivity {
method getContentLayoutId (line 18) | @Override
method onCreate (line 23) | @Override
method onInteractiveButtonClicked (line 50) | @OnClick(R.id.interactive_button)
FILE: sample/src/main/java/com/fractalwrench/androidbootstrap/sample/BootstrapBadgeExample.java
class BootstrapBadgeExample (line 13) | public class BootstrapBadgeExample extends BaseActivity {
method getContentLayoutId (line 19) | @Override
method onCreate (line 24) | @Override
method onLonelyButtonClicked (line 32) | @OnClick(R.id.lonely_badge)
method onXmlButtonClicked (line 37) | @OnClick(R.id.xml_badge_button)
method onJavaButtonClicked (line 42) | @OnClick(R.id.java_badge_button)
FILE: sample/src/main/java/com/fractalwrench/androidbootstrap/sample/BootstrapButtonExample.java
class BootstrapButtonExample (line 13) | public class BootstrapButtonExample extends BaseActivity {
method getContentLayoutId (line 15) | @Override protected int getContentLayoutId() {
method onCreate (line 27) | @Override protected void onCreate(Bundle savedInstanceState) {
method onCornersExampleClicked (line 32) | @OnClick(R.id.bbutton_example_corners) void onCornersExampleClicked() {
method onOutlineExampleClicked (line 36) | @OnClick(R.id.bbutton_example_outline) void onOutlineExampleClicked() {
method onSizeExampleClicked (line 40) | @OnClick(R.id.bbutton_example_size) void onSizeExampleClicked() {
method onThemeExampleClicked (line 61) | @OnClick(R.id.bbutton_example_theme) void onThemeExampleClicked() {
method setupCustomStyle (line 87) | private void setupCustomStyle() {
FILE: sample/src/main/java/com/fractalwrench/androidbootstrap/sample/BootstrapButtonGroupExample.java
class BootstrapButtonGroupExample (line 15) | public class BootstrapButtonGroupExample extends BaseActivity {
method getContentLayoutId (line 17) | @Override protected int getContentLayoutId() {
method onCreate (line 36) | @Override
method onOrientationChangeExampleClicked (line 67) | @OnClick(R.id.bbutton_group_orientation_change_btn) void onOrientation...
method onOutlineChangeExampleClicked (line 73) | @OnClick(R.id.bbutton_group_outline_change_btn) void onOutlineChangeEx...
method onRoundedChangeExampleClicked (line 77) | @OnClick(R.id.bbutton_group_rounded_change_btn) void onRoundedChangeEx...
method onChildAddExampleClicked (line 81) | @OnClick(R.id.bbutton_group_child_add_btn) void onChildAddExampleClick...
method onChildRemoveExampleClicked (line 90) | @OnClick(R.id.bbutton_group_child_remove_btn) void onChildRemoveExampl...
method onBrandChangeExampleClicked (line 98) | @OnClick(R.id.bbutton_group_brand_change_btn) void onBrandChangeExampl...
method onSizeChangeExampleClicked (line 125) | @OnClick(R.id.bbutton_group_size_change_btn) void onSizeChangeExampleC...
FILE: sample/src/main/java/com/fractalwrench/androidbootstrap/sample/BootstrapCircleThumbnailExample.java
class BootstrapCircleThumbnailExample (line 24) | public class BootstrapCircleThumbnailExample extends BaseActivity {
method getContentLayoutId (line 31) | @Override protected int getContentLayoutId() {
method onCreate (line 43) | @Override protected void onCreate(Bundle savedInstanceState) {
method getLayoutParams (line 55) | private LinearLayout.LayoutParams getLayoutParams(float factor) {
method onThemeChangeExampleClicked (line 60) | @OnClick(R.id.bcircle_theme_change_example) void onThemeChangeExampleC...
method onImageChangeExampleClicked (line 86) | @OnClick(R.id.bcircle_image_change_example) void onImageChangeExampleC...
method onBorderChangeExampleClicked (line 101) | @OnClick(R.id.bcircle_border_change_example) void onBorderChangeExampl...
method onSizeChangeExampleClicked (line 105) | @OnClick(R.id.bcircle_size_change_example) void onSizeChangeExampleCli...
FILE: sample/src/main/java/com/fractalwrench/androidbootstrap/sample/BootstrapDropDownExample.java
class BootstrapDropDownExample (line 6) | public class BootstrapDropDownExample extends Activity {
method onCreate (line 8) | @Override
FILE: sample/src/main/java/com/fractalwrench/androidbootstrap/sample/BootstrapEditTextExample.java
class BootstrapEditTextExample (line 18) | public class BootstrapEditTextExample extends BaseActivity {
method getContentLayoutId (line 20) | @Override protected int getContentLayoutId() {
method onChangeEnabledExampleClicked (line 31) | @OnClick(R.id.bedit_text_change_enabled_btn) void onChangeEnabledExamp...
method onChangeRoundExampleClicked (line 35) | @OnClick(R.id.bedit_text_change_round_btn) void onChangeRoundExampleCl...
method onChangeThemeExampleClicked (line 39) | @OnClick(R.id.bedit_text_change_theme_btn) void onChangeThemeExampleCl...
method onSizeExampleClicked (line 65) | @OnClick(R.id.bedit_text_change_size_btn) void onSizeExampleClicked() {
FILE: sample/src/main/java/com/fractalwrench/androidbootstrap/sample/BootstrapLabelExample.java
class BootstrapLabelExample (line 17) | public class BootstrapLabelExample extends BaseActivity {
method getContentLayoutId (line 19) | @Override protected int getContentLayoutId() {
method onHeadingChangeClicked (line 27) | @OnClick(R.id.example_blabel_change_heading) void onHeadingChangeClick...
method onColorChangeClicked (line 53) | @OnClick(R.id.example_blabel_change_color) void onColorChangeClicked() {
method onRoundedChangeClicked (line 82) | @OnClick(R.id.example_blabel_change_rounded) void onRoundedChangeClick...
FILE: sample/src/main/java/com/fractalwrench/androidbootstrap/sample/BootstrapProgressBarExample.java
class BootstrapProgressBarExample (line 12) | public class BootstrapProgressBarExample extends BaseActivity {
type ChangeState (line 14) | enum ChangeState {
method ChangeState (line 23) | ChangeState(boolean animated, boolean striped) {
method next (line 28) | public ChangeState next() {
method getContentLayoutId (line 48) | @Override protected int getContentLayoutId() {
method onDefaultClicked (line 59) | @OnClick(R.id.example_progress_default_btn) void onDefaultClicked() {
method onAnimatedClicked (line 63) | @OnClick(R.id.example_progress_animated_btn) void onAnimatedClicked() {
method onStripedClicked (line 67) | @OnClick(R.id.example_progress_striped_btn) void onStripedClicked() {
method onStripedAnimClicked (line 71) | @OnClick(R.id.example_progress_striped_animated_btn) void onStripedAni...
method onAlterProgressBarParameters (line 75) | @OnClick(R.id.example_progress_change_type_btn) void onAlterProgressBa...
method onChangeRoundedProgressBar (line 81) | @OnClick(R.id.example_progress_change_rounded_btn) void onChangeRounde...
method onAlterProgressBarColor (line 85) | @OnClick(R.id.example_progress_change_color_btn) void onAlterProgressB...
method onSizeExampleChangeClicked (line 110) | @OnClick(R.id.example_size_change_btn) void onSizeExampleChangeClicked...
method randomProgress (line 131) | private int randomProgress(int currentProgress, int maxProgress) {
FILE: sample/src/main/java/com/fractalwrench/androidbootstrap/sample/BootstrapProgressBarGroupExample.java
class BootstrapProgressBarGroupExample (line 14) | public class BootstrapProgressBarGroupExample extends BaseActivity {
method getContentLayoutId (line 30) | @Override
method addToGroup (line 35) | @OnClick(R.id.example_progress_bar_group_add)
method onRoundClick (line 53) | @OnClick(R.id.example_progress_bar_group_round)
method onClickProgressChange (line 59) | @OnClick(R.id.example_progress_bar_group_progress)
FILE: sample/src/main/java/com/fractalwrench/androidbootstrap/sample/BootstrapThumbnailExample.java
class BootstrapThumbnailExample (line 24) | public class BootstrapThumbnailExample extends BaseActivity {
method getContentLayoutId (line 29) | @Override protected int getContentLayoutId() {
method onCreate (line 42) | @Override protected void onCreate(Bundle savedInstanceState) {
method getLayoutParams (line 54) | private LinearLayout.LayoutParams getLayoutParams(float factor) {
method onThemeChangeExampleClicked (line 60) | @OnClick(R.id.bthumb_theme_change_example) void onThemeChangeExampleCl...
method onImageChangeExampleClicked (line 86) | @OnClick(R.id.bthumb_image_change_example) void onImageChangeExampleCl...
method onRoundedChangeExampleClicked (line 101) | @OnClick(R.id.bthumb_rounded_change_example) void onRoundedChangeExamp...
method onBorderChangeExampleClicked (line 105) | @OnClick(R.id.bthumb_border_change_example) void onBorderChangeExample...
method onSizeChangeExampleClicked (line 109) | @OnClick(R.id.bthumb_size_change_example) void onSizeChangeExampleClic...
FILE: sample/src/main/java/com/fractalwrench/androidbootstrap/sample/BootstrapWellExample.java
class BootstrapWellExample (line 6) | public class BootstrapWellExample extends Activity {
method onCreate (line 8) | @Override
FILE: sample/src/main/java/com/fractalwrench/androidbootstrap/sample/CustomBootstrapStyle.java
class CustomBootstrapStyle (line 11) | public class CustomBootstrapStyle implements BootstrapBrand {
method CustomBootstrapStyle (line 23) | @SuppressWarnings("deprecation") public CustomBootstrapStyle(Context c...
method defaultFill (line 35) | @Override public int defaultFill(Context context) {
method defaultEdge (line 39) | @Override public int defaultEdge(Context context) {
method defaultTextColor (line 43) | @Override public int defaultTextColor(Context context) {
method activeFill (line 47) | @Override public int activeFill(Context context) {
method activeEdge (line 51) | @Override public int activeEdge(Context context) {
method activeTextColor (line 55) | @Override public int activeTextColor(Context context) {
method disabledFill (line 59) | @Override public int disabledFill(Context context) {
method disabledEdge (line 63) | @Override public int disabledEdge(Context context) {
method disabledTextColor (line 67) | @Override public int disabledTextColor(Context context) {
method getColor (line 71) | @Override public int getColor() {
FILE: sample/src/main/java/com/fractalwrench/androidbootstrap/sample/HomeActivity.java
class HomeActivity (line 11) | public class HomeActivity extends AppCompatActivity {
method onCreate (line 13) | @Override protected void onCreate(Bundle savedInstanceState) {
method onGithubClicked (line 19) | @OnClick(R.id.github_btn) void onGithubClicked() {
method onBootstrapButtonExampleClicked (line 25) | @OnClick(R.id.example_bootstrap_button) void onBootstrapButtonExampleC...
method onFontAwesomeTextExampleClicked (line 29) | @OnClick(R.id.example_fontawesometext) void onFontAwesomeTextExampleCl...
method onBootstrapLabelExampleClicked (line 33) | @OnClick(R.id.example_bootstrap_label) void onBootstrapLabelExampleCli...
method onBootstrapProgressExampleClicked (line 37) | @OnClick(R.id.example_bootstrap_progress) void onBootstrapProgressExam...
method onBootstrapProgressGroupExampleClicked (line 41) | @OnClick(R.id.example_bootstrap_progress_group) void onBootstrapProgre...
method onBootstrapButtonGroupExampleClicked (line 45) | @OnClick(R.id.example_bootstrap_btn_group) void onBootstrapButtonGroup...
method onBootstrapCircleThumbnailExampleClicked (line 49) | @OnClick(R.id.example_bootstrap_cricle_thumbnail) void onBootstrapCirc...
method onBootstrapEditTextExampleClicked (line 53) | @OnClick(R.id.example_bootstrap_edit_text) void onBootstrapEditTextExa...
method onBootstrapThumbnailExampleClicked (line 57) | @OnClick(R.id.example_bootstrap_thumbnail) void onBootstrapThumbnailEx...
method onBootstrapWellExampleClicked (line 61) | @OnClick(R.id.example_bootstrap_well) void onBootstrapWellExampleClick...
method onBootstrapDropdownExampleClicked (line 65) | @OnClick(R.id.example_bootstrap_dropdown) void onBootstrapDropdownExam...
method onBootstrapAlertExampleClicked (line 68) | @OnClick(R.id.example_bootstrap_alert) void onBootstrapAlertExampleCli...
method onBootstrapBadgeExampleClicked (line 72) | @OnClick(R.id.example_bootstrap_badge) void onBootstrapBadgeExampleCli...
FILE: sample/src/main/java/com/fractalwrench/androidbootstrap/sample/SampleApplication.java
class SampleApplication (line 10) | public class SampleApplication extends Application {
method onCreate (line 12) | @Override public void onCreate() {
Condensed preview — 111 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (895K chars).
[
{
"path": ".gitignore",
"chars": 188,
"preview": "# generated files\nbin/\ngen/\n\n# Local configuration file (sdk path, etc)\nlocal.properties\n\n# IntelliJ files\n.idea\n*.iml\n\n"
},
{
"path": "ADD_FONT.md",
"chars": 1239,
"preview": "Adding a Custom Font\n=================\n\nAndroid Bootstrap uses Typeface Icon Sets, which provide scalable graphics witho"
},
{
"path": "AndroidBootstrap/build.gradle",
"chars": 517,
"preview": "apply plugin: 'com.android.library'\napply from: 'push.gradle'\n\nandroid {\n compileSdkVersion Integer.parseInt(TARGET_S"
},
{
"path": "AndroidBootstrap/proguard-project.txt",
"chars": 781,
"preview": "# To enable ProGuard in your project, edit project.properties\n# to define the proguard.config property as described in t"
},
{
"path": "AndroidBootstrap/push.gradle",
"chars": 3633,
"preview": "/*\n * Copyright 2013 Chris Banes\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not us"
},
{
"path": "AndroidBootstrap/src/main/AndroidManifest.xml",
"chars": 93,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<manifest package=\"com.beardedhen.androidbootstrap\" />"
},
{
"path": "AndroidBootstrap/src/main/java/com/beardedhen/androidbootstrap/AwesomeTextView.java",
"chars": 10684,
"preview": "package com.beardedhen.androidbootstrap;\n\nimport android.content.Context;\nimport android.content.res.TypedArray;\nimport "
},
{
"path": "AndroidBootstrap/src/main/java/com/beardedhen/androidbootstrap/BetaApi.java",
"chars": 230,
"preview": "package com.beardedhen.androidbootstrap;\n\n/**\n * Any class marked with this annotation is subject to Major API changes w"
},
{
"path": "AndroidBootstrap/src/main/java/com/beardedhen/androidbootstrap/BootstrapAlert.java",
"chars": 11169,
"preview": "package com.beardedhen.androidbootstrap;\n\nimport android.content.Context;\nimport android.content.res.TypedArray;\nimport "
},
{
"path": "AndroidBootstrap/src/main/java/com/beardedhen/androidbootstrap/BootstrapBadge.java",
"chars": 4205,
"preview": "package com.beardedhen.androidbootstrap;\n\nimport android.content.Context;\nimport android.content.res.TypedArray;\nimport "
},
{
"path": "AndroidBootstrap/src/main/java/com/beardedhen/androidbootstrap/BootstrapBaseThumbnail.java",
"chars": 7367,
"preview": "package com.beardedhen.androidbootstrap;\n\nimport android.annotation.TargetApi;\nimport android.content.Context;\nimport an"
},
{
"path": "AndroidBootstrap/src/main/java/com/beardedhen/androidbootstrap/BootstrapButton.java",
"chars": 13770,
"preview": "package com.beardedhen.androidbootstrap;\n\nimport android.content.Context;\nimport android.content.res.TypedArray;\nimport "
},
{
"path": "AndroidBootstrap/src/main/java/com/beardedhen/androidbootstrap/BootstrapButtonGroup.java",
"chars": 10400,
"preview": "package com.beardedhen.androidbootstrap;\n\nimport android.content.Context;\nimport android.content.res.TypedArray;\nimport "
},
{
"path": "AndroidBootstrap/src/main/java/com/beardedhen/androidbootstrap/BootstrapCircleThumbnail.java",
"chars": 6745,
"preview": "package com.beardedhen.androidbootstrap;\n\nimport android.content.Context;\nimport android.content.res.TypedArray;\nimport "
},
{
"path": "AndroidBootstrap/src/main/java/com/beardedhen/androidbootstrap/BootstrapDrawableFactory.java",
"chars": 24067,
"preview": "package com.beardedhen.androidbootstrap;\n\nimport android.content.Context;\nimport android.content.res.ColorStateList;\nimp"
},
{
"path": "AndroidBootstrap/src/main/java/com/beardedhen/androidbootstrap/BootstrapDropDown.java",
"chars": 19474,
"preview": "package com.beardedhen.androidbootstrap;\n\nimport android.content.Context;\nimport android.content.res.TypedArray;\nimport "
},
{
"path": "AndroidBootstrap/src/main/java/com/beardedhen/androidbootstrap/BootstrapEditText.java",
"chars": 6247,
"preview": "package com.beardedhen.androidbootstrap;\n\nimport android.content.Context;\nimport android.content.res.TypedArray;\nimport "
},
{
"path": "AndroidBootstrap/src/main/java/com/beardedhen/androidbootstrap/BootstrapGroup.java",
"chars": 2347,
"preview": "package com.beardedhen.androidbootstrap;\n\nimport android.content.Context;\nimport android.support.annotation.NonNull;\nimp"
},
{
"path": "AndroidBootstrap/src/main/java/com/beardedhen/androidbootstrap/BootstrapLabel.java",
"chars": 4635,
"preview": "package com.beardedhen.androidbootstrap;\n\nimport android.content.Context;\nimport android.content.res.TypedArray;\nimport "
},
{
"path": "AndroidBootstrap/src/main/java/com/beardedhen/androidbootstrap/BootstrapProgressBar.java",
"chars": 21274,
"preview": "package com.beardedhen.androidbootstrap;\n\nimport android.animation.Animator;\nimport android.animation.ValueAnimator;\nimp"
},
{
"path": "AndroidBootstrap/src/main/java/com/beardedhen/androidbootstrap/BootstrapProgressBarGroup.java",
"chars": 9588,
"preview": "package com.beardedhen.androidbootstrap;\n\nimport android.content.Context;\nimport android.content.res.TypedArray;\nimport "
},
{
"path": "AndroidBootstrap/src/main/java/com/beardedhen/androidbootstrap/BootstrapText.java",
"chars": 4647,
"preview": "package com.beardedhen.androidbootstrap;\n\nimport android.content.Context;\nimport android.text.SpannableString;\nimport an"
},
{
"path": "AndroidBootstrap/src/main/java/com/beardedhen/androidbootstrap/BootstrapThumbnail.java",
"chars": 5621,
"preview": "package com.beardedhen.androidbootstrap;\n\nimport android.content.Context;\nimport android.content.res.TypedArray;\nimport "
},
{
"path": "AndroidBootstrap/src/main/java/com/beardedhen/androidbootstrap/BootstrapWell.java",
"chars": 2243,
"preview": "package com.beardedhen.androidbootstrap;\n\nimport android.content.Context;\nimport android.content.res.TypedArray;\nimport "
},
{
"path": "AndroidBootstrap/src/main/java/com/beardedhen/androidbootstrap/IconResolver.java",
"chars": 5378,
"preview": "package com.beardedhen.androidbootstrap;\n\nimport android.content.Context;\n\nimport com.beardedhen.androidbootstrap.font.F"
},
{
"path": "AndroidBootstrap/src/main/java/com/beardedhen/androidbootstrap/TypefaceProvider.java",
"chars": 3351,
"preview": "package com.beardedhen.androidbootstrap;\n\nimport android.content.Context;\nimport android.graphics.Typeface;\n\nimport com."
},
{
"path": "AndroidBootstrap/src/main/java/com/beardedhen/androidbootstrap/api/attributes/BootstrapBrand.java",
"chars": 2584,
"preview": "package com.beardedhen.androidbootstrap.api.attributes;\n\nimport android.content.Context;\nimport android.support.annotati"
},
{
"path": "AndroidBootstrap/src/main/java/com/beardedhen/androidbootstrap/api/attributes/BootstrapHeading.java",
"chars": 1037,
"preview": "package com.beardedhen.androidbootstrap.api.attributes;\n\nimport android.content.Context;\n\nimport java.io.Serializable;\n\n"
},
{
"path": "AndroidBootstrap/src/main/java/com/beardedhen/androidbootstrap/api/attributes/ViewGroupPosition.java",
"chars": 174,
"preview": "package com.beardedhen.androidbootstrap.api.attributes;\n\npublic enum ViewGroupPosition {\n SOLO,\n MIDDLE_HORI,\n "
},
{
"path": "AndroidBootstrap/src/main/java/com/beardedhen/androidbootstrap/api/defaults/ButtonMode.java",
"chars": 502,
"preview": "package com.beardedhen.androidbootstrap.api.defaults;\n\npublic enum ButtonMode {\n REGULAR,\n TOGGLE,\n CHECKBOX,\n "
},
{
"path": "AndroidBootstrap/src/main/java/com/beardedhen/androidbootstrap/api/defaults/DefaultBootstrapBrand.java",
"chars": 3582,
"preview": "package com.beardedhen.androidbootstrap.api.defaults;\n\nimport android.content.Context;\nimport android.support.annotation"
},
{
"path": "AndroidBootstrap/src/main/java/com/beardedhen/androidbootstrap/api/defaults/DefaultBootstrapHeading.java",
"chars": 2451,
"preview": "package com.beardedhen.androidbootstrap.api.defaults;\n\nimport android.content.Context;\nimport android.support.annotation"
},
{
"path": "AndroidBootstrap/src/main/java/com/beardedhen/androidbootstrap/api/defaults/DefaultBootstrapSize.java",
"chars": 1099,
"preview": "package com.beardedhen.androidbootstrap.api.defaults;\n\n/**\n * Bootstrap provides 5 sizes - XS, SM, MD, LG, and XL. In th"
},
{
"path": "AndroidBootstrap/src/main/java/com/beardedhen/androidbootstrap/api/defaults/ExpandDirection.java",
"chars": 367,
"preview": "package com.beardedhen.androidbootstrap.api.defaults;\n\n\npublic enum ExpandDirection {\n UP,\n DOWN;\n\n public stat"
},
{
"path": "AndroidBootstrap/src/main/java/com/beardedhen/androidbootstrap/api/view/BadgeContainerView.java",
"chars": 870,
"preview": "package com.beardedhen.androidbootstrap.api.view;\n\nimport com.beardedhen.androidbootstrap.BootstrapBadge;\n\n/**\n * Classe"
},
{
"path": "AndroidBootstrap/src/main/java/com/beardedhen/androidbootstrap/api/view/BootstrapBadgeView.java",
"chars": 448,
"preview": "package com.beardedhen.androidbootstrap.api.view;\n\nimport android.support.annotation.Nullable;\n\npublic interface Bootstr"
},
{
"path": "AndroidBootstrap/src/main/java/com/beardedhen/androidbootstrap/api/view/BootstrapBrandView.java",
"chars": 716,
"preview": "package com.beardedhen.androidbootstrap.api.view;\n\nimport android.support.annotation.NonNull;\n\nimport com.beardedhen.and"
},
{
"path": "AndroidBootstrap/src/main/java/com/beardedhen/androidbootstrap/api/view/BootstrapHeadingView.java",
"chars": 787,
"preview": "package com.beardedhen.androidbootstrap.api.view;\n\nimport android.support.annotation.NonNull;\n\nimport com.beardedhen.and"
},
{
"path": "AndroidBootstrap/src/main/java/com/beardedhen/androidbootstrap/api/view/BootstrapSizeView.java",
"chars": 1354,
"preview": "package com.beardedhen.androidbootstrap.api.view;\n\nimport com.beardedhen.androidbootstrap.api.defaults.DefaultBootstrapS"
},
{
"path": "AndroidBootstrap/src/main/java/com/beardedhen/androidbootstrap/api/view/BootstrapTextView.java",
"chars": 908,
"preview": "package com.beardedhen.androidbootstrap.api.view;\n\nimport android.support.annotation.Nullable;\n\nimport com.beardedhen.an"
},
{
"path": "AndroidBootstrap/src/main/java/com/beardedhen/androidbootstrap/api/view/BorderView.java",
"chars": 563,
"preview": "package com.beardedhen.androidbootstrap.api.view;\n\n/**\n * Views which implement this interface allow the border to be dy"
},
{
"path": "AndroidBootstrap/src/main/java/com/beardedhen/androidbootstrap/api/view/ButtonModeView.java",
"chars": 595,
"preview": "package com.beardedhen.androidbootstrap.api.view;\n\nimport android.support.annotation.NonNull;\n\nimport com.beardedhen.and"
},
{
"path": "AndroidBootstrap/src/main/java/com/beardedhen/androidbootstrap/api/view/OutlineableView.java",
"chars": 597,
"preview": "package com.beardedhen.androidbootstrap.api.view;\n\n/**\n * Views which implement this interface allow the user to specify"
},
{
"path": "AndroidBootstrap/src/main/java/com/beardedhen/androidbootstrap/api/view/ProgressView.java",
"chars": 1916,
"preview": "package com.beardedhen.androidbootstrap.api.view;\n\n/**\n * Views which implement this interface visually display ongoing "
},
{
"path": "AndroidBootstrap/src/main/java/com/beardedhen/androidbootstrap/api/view/RoundableView.java",
"chars": 672,
"preview": "package com.beardedhen.androidbootstrap.api.view;\n\n/**\n * Views which implement this interface allow the user to specify"
},
{
"path": "AndroidBootstrap/src/main/java/com/beardedhen/androidbootstrap/font/AwesomeTypefaceSpan.java",
"chars": 1004,
"preview": "package com.beardedhen.androidbootstrap.font;\n\nimport android.content.Context;\nimport android.support.annotation.NonNull"
},
{
"path": "AndroidBootstrap/src/main/java/com/beardedhen/androidbootstrap/font/FontAwesome.java",
"chars": 138969,
"preview": "package com.beardedhen.androidbootstrap.font;\n\nimport android.support.annotation.StringDef;\n\nimport java.lang.annotation"
},
{
"path": "AndroidBootstrap/src/main/java/com/beardedhen/androidbootstrap/font/IconSet.java",
"chars": 750,
"preview": "package com.beardedhen.androidbootstrap.font;\n\n/**\n * Specifies the icon codes for a Typeface, and provides the filename"
},
{
"path": "AndroidBootstrap/src/main/java/com/beardedhen/androidbootstrap/font/MaterialIcons.java",
"chars": 149208,
"preview": "package com.beardedhen.androidbootstrap.font;\n\nimport com.beardedhen.androidbootstrap.font.IconSet;\n\nimport java.util.Ha"
},
{
"path": "AndroidBootstrap/src/main/java/com/beardedhen/androidbootstrap/font/Typicon.java",
"chars": 64850,
"preview": "package com.beardedhen.androidbootstrap.font;\n\nimport android.support.annotation.StringDef;\n\nimport java.lang.annotation"
},
{
"path": "AndroidBootstrap/src/main/java/com/beardedhen/androidbootstrap/utils/ColorUtils.java",
"chars": 2672,
"preview": "package com.beardedhen.androidbootstrap.utils;\n\nimport android.content.Context;\nimport android.graphics.Color;\nimport an"
},
{
"path": "AndroidBootstrap/src/main/java/com/beardedhen/androidbootstrap/utils/DimenUtils.java",
"chars": 1616,
"preview": "package com.beardedhen.androidbootstrap.utils;\n\nimport android.content.Context;\nimport android.content.res.Resources;\nim"
},
{
"path": "AndroidBootstrap/src/main/java/com/beardedhen/androidbootstrap/utils/DrawableUtils.java",
"chars": 686,
"preview": "package com.beardedhen.androidbootstrap.utils;\n\nimport android.content.Context;\nimport android.content.res.Resources;\nim"
},
{
"path": "AndroidBootstrap/src/main/java/com/beardedhen/androidbootstrap/utils/ViewUtils.java",
"chars": 682,
"preview": "package com.beardedhen.androidbootstrap.utils;\n\nimport android.graphics.drawable.Drawable;\nimport android.os.Build;\nimpo"
},
{
"path": "AndroidBootstrap/src/main/res/values/attrs.xml",
"chars": 5089,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<resources>\n\n <!-- Common attributes -->\n\n <attr name=\"bootstrapBrand\" form"
},
{
"path": "AndroidBootstrap/src/main/res/values/attrs_font_awesome.xml",
"chars": 33217,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<resources>\n\n <attr name=\"fontAwesomeIcon\" format=\"enum\">\n <enum name=\""
},
{
"path": "AndroidBootstrap/src/main/res/values/attrs_materialIcon.xml",
"chars": 47056,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<resources>\n <attr name=\"materialIcon\" format=\"enum\">\n <enum name=\"md_3"
},
{
"path": "AndroidBootstrap/src/main/res/values/attrs_typicons.xml",
"chars": 17112,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<resources>\n\n <attr name=\"typicon\" format=\"enum\">\n <enum name=\"ty_adjus"
},
{
"path": "AndroidBootstrap/src/main/res/values/colors.xml",
"chars": 1363,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<resources>\n\n <!-- Bootstrap Brand Colors (Universal) -->\n\n <!-- Grayscale "
},
{
"path": "AndroidBootstrap/src/main/res/values/dimens.xml",
"chars": 3370,
"preview": "<resources>\n\n <!-- Default button size -->\n <dimen name=\"bootstrap_button_default_font_size\">14sp</dimen>\n <dim"
},
{
"path": "LICENSE.txt",
"chars": 1083,
"preview": "The MIT License (MIT)\n\nCopyright (c) 2013-2016 Bearded Hen\n\nPermission is hereby granted, free of charge, to any person "
},
{
"path": "README.md",
"chars": 11431,
"preview": "Android-Bootstrap\n=================\nAndroid Bootstrap is an Android library which provides custom views styled according"
},
{
"path": "TODO.md",
"chars": 194,
"preview": "Feature (Wish)List\n=============\n* More Views in Bootstrap Spec\n* Add Bootstrap input groups\n* Add BootstrapCardView and"
},
{
"path": "build.gradle",
"chars": 436,
"preview": "// Top-level build file where you can add configuration options common to all sub-projects/modules.\nbuildscript {\n re"
},
{
"path": "circle.yml",
"chars": 1259,
"preview": "dependencies:\n pre:\n # Android SDK Platform 25\n - if [ ! -d \"/usr/local/android-sdk-linux/platforms/android-25\" ]"
},
{
"path": "gradle/wrapper/gradle-wrapper.properties",
"chars": 230,
"preview": "#Sat Jul 22 10:14:14 BST 2017\ndistributionBase=GRADLE_USER_HOME\ndistributionPath=wrapper/dists\nzipStoreBase=GRADLE_USER_"
},
{
"path": "gradle.properties",
"chars": 720,
"preview": "VERSION_NAME=2.3.2\nVERSION_CODE=232\nGROUP=com.beardedhen\n\nMIN_SDK_INT=14\nTARGET_SDK_INT=25\n\nPOM_DESCRIPTION=Bootstrap st"
},
{
"path": "gradlew",
"chars": 4971,
"preview": "#!/usr/bin/env bash\n\n##############################################################################\n##\n## Gradle start "
},
{
"path": "gradlew.bat",
"chars": 2404,
"preview": "@if \"%DEBUG%\" == \"\" @echo off\r\n@rem ##########################################################################\r\n@rem\r\n@r"
},
{
"path": "sample/.gitignore",
"chars": 7,
"preview": "/build\n"
},
{
"path": "sample/build.gradle",
"chars": 1106,
"preview": "apply plugin: 'com.android.application'\n\nandroid {\n compileSdkVersion Integer.parseInt(TARGET_SDK_INT)\n buildTools"
},
{
"path": "sample/proguard-rules.pro",
"chars": 257,
"preview": "# Butterknife\n\n-keep class butterknife.** { *; }\n-dontwarn butterknife.internal.**\n-keep class **$$ViewBinder { *; }\n\n-k"
},
{
"path": "sample/src/main/AndroidManifest.xml",
"chars": 2546,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<manifest\n package=\"com.fractalwrench.androidbootstrap.sample\"\n xmlns:andro"
},
{
"path": "sample/src/main/java/com/fractalwrench/androidbootstrap/sample/AwesomeTextViewExample.java",
"chars": 2784,
"preview": "package com.fractalwrench.androidbootstrap.sample;\n\nimport android.os.Bundle;\n\nimport com.beardedhen.androidbootstrap.Aw"
},
{
"path": "sample/src/main/java/com/fractalwrench/androidbootstrap/sample/BaseActivity.java",
"chars": 915,
"preview": "package com.fractalwrench.androidbootstrap.sample;\n\nimport android.os.Bundle;\nimport android.support.annotation.LayoutRe"
},
{
"path": "sample/src/main/java/com/fractalwrench/androidbootstrap/sample/BootstrapAlertExample.java",
"chars": 1653,
"preview": "package com.fractalwrench.androidbootstrap.sample;\n\nimport android.os.Bundle;\nimport android.util.Log;\nimport android.vi"
},
{
"path": "sample/src/main/java/com/fractalwrench/androidbootstrap/sample/BootstrapBadgeExample.java",
"chars": 1374,
"preview": "package com.fractalwrench.androidbootstrap.sample;\n\nimport android.os.Bundle;\n\nimport com.beardedhen.androidbootstrap.Bo"
},
{
"path": "sample/src/main/java/com/fractalwrench/androidbootstrap/sample/BootstrapButtonExample.java",
"chars": 3374,
"preview": "package com.fractalwrench.androidbootstrap.sample;\n\nimport android.os.Bundle;\nimport android.util.Log;\n\nimport com.beard"
},
{
"path": "sample/src/main/java/com/fractalwrench/androidbootstrap/sample/BootstrapButtonGroupExample.java",
"chars": 5611,
"preview": "package com.fractalwrench.androidbootstrap.sample;\n\nimport android.os.Bundle;\nimport android.widget.LinearLayout;\nimport"
},
{
"path": "sample/src/main/java/com/fractalwrench/androidbootstrap/sample/BootstrapCircleThumbnailExample.java",
"chars": 5079,
"preview": "package com.fractalwrench.androidbootstrap.sample;\n\nimport android.graphics.Bitmap;\nimport android.graphics.BitmapFactor"
},
{
"path": "sample/src/main/java/com/fractalwrench/androidbootstrap/sample/BootstrapDropDownExample.java",
"chars": 350,
"preview": "package com.fractalwrench.androidbootstrap.sample;\n\nimport android.app.Activity;\nimport android.os.Bundle;\n\npublic class"
},
{
"path": "sample/src/main/java/com/fractalwrench/androidbootstrap/sample/BootstrapEditTextExample.java",
"chars": 3330,
"preview": "package com.fractalwrench.androidbootstrap.sample;\n\nimport com.beardedhen.androidbootstrap.BootstrapEditText;\nimport com"
},
{
"path": "sample/src/main/java/com/fractalwrench/androidbootstrap/sample/BootstrapLabelExample.java",
"chars": 3510,
"preview": "package com.fractalwrench.androidbootstrap.sample;\n\nimport com.beardedhen.androidbootstrap.BootstrapLabel;\nimport com.be"
},
{
"path": "sample/src/main/java/com/fractalwrench/androidbootstrap/sample/BootstrapProgressBarExample.java",
"chars": 5040,
"preview": "package com.fractalwrench.androidbootstrap.sample;\n\nimport com.beardedhen.androidbootstrap.BootstrapProgressBar;\nimport "
},
{
"path": "sample/src/main/java/com/fractalwrench/androidbootstrap/sample/BootstrapProgressBarGroupExample.java",
"chars": 2282,
"preview": "package com.fractalwrench.androidbootstrap.sample;\n\nimport com.beardedhen.androidbootstrap.BootstrapProgressBar;\nimport "
},
{
"path": "sample/src/main/java/com/fractalwrench/androidbootstrap/sample/BootstrapThumbnailExample.java",
"chars": 5301,
"preview": "package com.fractalwrench.androidbootstrap.sample;\n\nimport android.graphics.Bitmap;\nimport android.graphics.BitmapFactor"
},
{
"path": "sample/src/main/java/com/fractalwrench/androidbootstrap/sample/BootstrapWellExample.java",
"chars": 342,
"preview": "package com.fractalwrench.androidbootstrap.sample;\n\nimport android.app.Activity;\nimport android.os.Bundle;\n\npublic class"
},
{
"path": "sample/src/main/java/com/fractalwrench/androidbootstrap/sample/CustomBootstrapStyle.java",
"chars": 2559,
"preview": "package com.fractalwrench.androidbootstrap.sample;\n\nimport android.content.Context;\nimport android.support.annotation.Co"
},
{
"path": "sample/src/main/java/com/fractalwrench/androidbootstrap/sample/HomeActivity.java",
"chars": 2956,
"preview": "package com.fractalwrench.androidbootstrap.sample;\n\nimport android.content.Intent;\nimport android.net.Uri;\nimport androi"
},
{
"path": "sample/src/main/java/com/fractalwrench/androidbootstrap/sample/SampleApplication.java",
"chars": 455,
"preview": "package com.fractalwrench.androidbootstrap.sample;\n\nimport android.app.Application;\n\nimport com.beardedhen.androidbootst"
},
{
"path": "sample/src/main/res/layout/activity_base.xml",
"chars": 250,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<ScrollView xmlns:android=\"http://schemas.android.com/apk/res/android\"\n "
},
{
"path": "sample/src/main/res/layout/activity_main.xml",
"chars": 3721,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n\n<ScrollView\n xmlns:android=\"http://schemas.android.com/apk/res/android\"\n x"
},
{
"path": "sample/src/main/res/layout/example_awesome_text_view.xml",
"chars": 5993,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<LinearLayout\n style=\"@style/example_container\"\n xmlns:android=\"http://sche"
},
{
"path": "sample/src/main/res/layout/example_bootstrap_alert.xml",
"chars": 2584,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<LinearLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\n "
},
{
"path": "sample/src/main/res/layout/example_bootstrap_badge.xml",
"chars": 1937,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<LinearLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\n "
},
{
"path": "sample/src/main/res/layout/example_bootstrap_button.xml",
"chars": 17734,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n\n<LinearLayout\n style=\"@style/example_container\"\n xmlns:android=\"http://sch"
},
{
"path": "sample/src/main/res/layout/example_bootstrap_button_group.xml",
"chars": 13636,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n\n<LinearLayout\n style=\"@style/example_container\"\n xmlns:android=\"http://sch"
},
{
"path": "sample/src/main/res/layout/example_bootstrap_circle_thumbnail.xml",
"chars": 6306,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n\n<LinearLayout\n style=\"@style/example_container\"\n xmlns:android=\"http://sch"
},
{
"path": "sample/src/main/res/layout/example_bootstrap_dropdown.xml",
"chars": 8113,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<RelativeLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\n "
},
{
"path": "sample/src/main/res/layout/example_bootstrap_edit_text_view.xml",
"chars": 3705,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<LinearLayout\n style=\"@style/example_container\"\n xmlns:android=\"http://sche"
},
{
"path": "sample/src/main/res/layout/example_bootstrap_label.xml",
"chars": 9301,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n\n<LinearLayout\n style=\"@style/example_container\"\n xmlns:android=\"http://sch"
},
{
"path": "sample/src/main/res/layout/example_bootstrap_progress_bar.xml",
"chars": 6341,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n\n<LinearLayout\n style=\"@style/example_container\"\n xmlns:android=\"http://sch"
},
{
"path": "sample/src/main/res/layout/example_bootstrap_progress_bar_group.xml",
"chars": 5935,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<LinearLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\n "
},
{
"path": "sample/src/main/res/layout/example_bootstrap_thumbnail.xml",
"chars": 6735,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n\n<LinearLayout\n style=\"@style/example_container\"\n xmlns:android=\"http://sch"
},
{
"path": "sample/src/main/res/layout/example_bootstrap_well.xml",
"chars": 1842,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<LinearLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\n xmln"
},
{
"path": "sample/src/main/res/values/colors.xml",
"chars": 393,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<resources>\n\n <color name=\"custom_default_fill\">#33bbaa</color>\n <color nam"
},
{
"path": "sample/src/main/res/values/dimens.xml",
"chars": 168,
"preview": "<resources>\n <dimen name=\"default_padding\">16dp</dimen>\n <dimen name=\"micro_padding\">4dp</dimen>\n <dimen name=\""
},
{
"path": "sample/src/main/res/values/strings.xml",
"chars": 807,
"preview": "<resources>\n <string name=\"app_name\">Android Bootstrap</string>\n <array name=\"bootstrap_dropdown_example_data\">\n "
},
{
"path": "sample/src/main/res/values/styles.xml",
"chars": 2815,
"preview": "<resources xmlns:tools=\"http://schemas.android.com/tools\">\n\n <!-- Base application theme. -->\n <style name=\"AppThe"
},
{
"path": "settings.gradle",
"chars": 39,
"preview": "include ':AndroidBootstrap', ':sample'\n"
}
]
// ... and 1 more files (download for full content)
About this extraction
This page contains the full source code of the Bearded-Hen/Android-Bootstrap GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 111 files (821.0 KB), approximately 206.8k tokens, and a symbol index with 588 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.
Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.