Giter Site home page Giter Site logo

bearded-hen / android-bootstrap Goto Github PK

View Code? Open in Web Editor NEW
7.3K 388.0 1.4K 11.24 MB

Bootstrap style widgets for Android, with Glyph Icons

License: MIT License

Java 100.00%
java bootstrap-brands glyph-icons twitter-bootstrap-specification android-bootstrap android android-library widget android-ui android-animated-icons

android-bootstrap's Introduction

Android-Bootstrap

Android Bootstrap is an Android library which provides custom views styled according to the Twitter Bootstrap Specification. This allows you to spend more time on development rather than trying to get a consistent theme across your app, especially if you are already familiar with the Bootstrap Framework.

Quick Start

Maven Central CircleCI

Add the following dependency to your build.gradle, ensuring you replace 'X.X.X' with the latest version on the button above:

dependencies {
   compile 'com.beardedhen:androidbootstrap:{X.X.X}'
}

You should also override your application class with the following:

public class SampleApplication extends Application {
    @Override public void onCreate() {
        super.onCreate();
        TypefaceProvider.registerDefaultIconSets();
    }
}

You should then checkout the library and investigate the sample code, which covers most of the features. The sample app is also available on Google Play.

Support

If you have a question about how to use the project, please ask a question on StackOverflow, using the tag android-bootstrap-widgets.

If you think you have found a bug in the library, you should create a new issue instead.

Javadoc

The javadoc for the project is hosted on Github.

Examples

BootstrapButton

A button that supports Glyph icons, and is themeable using Bootstrap Brands.

<com.beardedhen.androidbootstrap.BootstrapButton
 android:layout_width="wrap_content"
 android:layout_height="wrap_content"
 android:text="BootstrapButton"
 app:bootstrapBrand="success"
 app:bootstrapSize="lg"
 app:buttonMode="regular"
 app:showOutline="false"
 app:roundedCorners="true"
 />

BootstrapButton

###BootstrapButtonGroup Allows BootstrapButtons to be grouped together and their attributes controlled en masse.

<com.beardedhen.androidbootstrap.BootstrapButtonGroup
 android:layout_width="wrap_content"
 android:layout_height="wrap_content"
 android:text="BootstrapButtonGroup"
 android:orientation="vertical"
 app:bootstrapBrand="success"
 app:bootstrapSize="lg"
 app:roundedCorners="true"
 >
 <com.beardedhen.androidbootstrap.BootstrapButton
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="BootstrapButton 1"
    />
 <com.beardedhen.androidbootstrap.BootstrapButton
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="BootstrapButton 2"
    />
</com.beardedhen.androidbootstrap.BootstrapButtonGroup>

BootstrapButtonGroup

AwesomeTextView

A text widget that displays Glyph icons, and is themeable using Bootstrap Brands.

<com.beardedhen.androidbootstrap.AwesomeTextView
 android:layout_width="wrap_content"
 android:layout_height="wrap_content"
 app:bootstrapBrand="success"
 app:fontAwesomeIcon="fa_android"
 />

AwesomeTextView

###BootstrapProgressBar Displays progress in a bar from 0-100, and animates updates to the current progress.

<com.beardedhen.androidbootstrap.BootstrapProgressBar
 android:layout_width="wrap_content"
 android:layout_height="wrap_content"
 app:animated="true"
 app:bootstrapBrand="warning"
 app:progress="78"
 app:striped="true"
 />

BootstrapProgressBar

BootstrapProgressBarGroup

Allows BootstrapProgressBars to be group together to have the effect of stacked progress bar.

     <com.beardedhen.androidbootstrap.BootstrapProgressBarGroup
         android:id="@+id/example_progress_bar_group_round_group"
         android:layout_width="match_parent"
         android:layout_height="wrap_content"
         android:layout_gravity="center_vertical"
         app:bootstrapSize="md"
         app:bootstrapMaxProgress="100">

         <com.beardedhen.androidbootstrap.BootstrapProgressBar
             android:layout_width="0dp"
             android:layout_height="wrap_content"
             app:bootstrapBrand="success"
             app:bootstrapProgress="20"
             />

         <com.beardedhen.androidbootstrap.BootstrapProgressBar
             android:layout_width="0dp"
             android:layout_height="wrap_content"
             app:bootstrapBrand="danger"
             app:bootstrapProgress="20"
             />

         </com.beardedhen.androidbootstrap.BootstrapProgressBarGroup>

BootstrapProgressBarGroup

###BootstrapLabel Displays non-clickable text in a widget similar to the BootstrapButton, sizable using H1-H6 elements.

<com.beardedhen.androidbootstrap.BootstrapLabel
 android:layout_width="wrap_content"
 android:layout_height="wrap_content"
 app:bootstrapBrand="primary"
 app:bootstrapHeading="h3"
 app:roundedCorners="true"
 android:text="Bootstrap Label"
 />

BootstrapLabel

BootstrapEditText

Allows editing of text in a widget themed using BootstrapBrand.

<com.beardedhen.androidbootstrap.BootstrapEditText
 android:layout_width="wrap_content"
 android:layout_height="wrap_content"
 app:bootstrapSize="md"
 app:bootstrapBrand="info"
 />

BootstrapEditText

###BootstrapCircleThumbnail Displays images in a center-cropped Circular View, themed with BootstrapBrand.

<com.beardedhen.androidbootstrap.BootstrapCircleThumbnail
 android:layout_width="wrap_content"
 android:layout_height="wrap_content"
 android:src="@drawable/my_drawable"
 app:bootstrapBrand="danger"
 app:hasBorder="true"
 />

BootstrapCircleThumbnail

BootstrapThumbnail

Displays images in a rectangular View, themed with BootstrapBrand.

<com.beardedhen.androidbootstrap.BootstrapThumbnail
 android:layout_width="wrap_content"
 android:layout_height="wrap_content"
 android:src="@drawable/my_drawable"
 app:bootstrapBrand="info"
 app:hasBorder="true"
 />

BootstrapThumbnail

###BootstrapWell Displays a view in a themed container.

<com.beardedhen.androidbootstrap.BootstrapWell
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_gravity="center"
        android:layout_margin="8dp"
        app:bootstrapSize="xl">

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:gravity="right"
            android:text="Look, I'm in a large well!"
            />
    </com.beardedhen.androidbootstrap.BootstrapWell>

BootstrapWell

###BootstrapDropDown Displays a view with dropdown options, supplied by an array of strings.

<com.beardedhen.androidbootstrap.BootstrapDropDown
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginLeft="8dp"
                app:bootstrapText="Medium {fa_thumbs_o_up}"
                app:bootstrapBrand="regular"
                app:roundedCorners="true"
                app:bootstrapSize="md"
                app:dropdownResource="@array/bootstrap_dropdown_example_data"
                app:bootstrapExpandDirection="down"/>

BootstrapDropdown

Custom Styles

Custom styles can be applied to any of the views in this library by creating a class which implements BootstrapBrand, and setting it on the View. Please see the sample code of BootstrapButton for more detail.

    class CustomBootstrapStyle implements BootstrapBrand {
        // specify desired colors here
    }

    BootstrapButton btn = new BootstrapButton(context);
    btn.setBootstrapBrand(new CustomBootstrapStyle(this);

Contributing

Contributions are very welcome! There are 3 main ways you can help out:

  1. Add more Icon Typefaces, using the instructions here
  2. Help implement views which are present in the Twitter Bootstrap Specification but are not yet in this library.
  3. Raise an issue if you see a bug or are unsure on how something works, or even better - send a pull-request with a fix!

Versioning

This project uses Semantic Versioning. There are several breaking changes in V2.X of the library, including:

  • AwesomeTextView replaces FontAwesomeText
  • Various altered method signatures/attributes for views
  • Global BootstrapBrand/BootstrapSize attributes replace view-specific enums

Please consider what effect these changes might have on your app before upgrading!

Contact

If you have any questions, issues, or just want to let us know where you're using Android Bootstrap tweet us at @BeardedHen, email [email protected], or head over to our website to see more of our creations.

Hall of Fame

Checkout AppBrain to see some of the apps which use Android Bootstrap!

android-bootstrap's People

Contributors

andersonmat avatar andybeardedhen avatar bryant1410 avatar ebuildy avatar fractalwrench avatar intrications avatar jamie-beardedhen avatar joshuapinter avatar k-ni-ght avatar keyboardsurfer avatar knightkill avatar luohaha avatar lzyzsd avatar mkuklis avatar msneujink avatar pelli23 avatar petehendryhen avatar thedazzler avatar tom-beardedhen avatar wendly avatar yongjhih avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

android-bootstrap's Issues

Gradle update, Maven

Could you update to a more recent build of gradle?
Could you check it in into Maven?

Android Studio Preview Issue

There was an issue with maven plugin version of Android-Bootstrap. After updating to Android Studio 1.0 its previews started giving NullPointerException because of setBootstrapType. I couldn't make any debugging without being able to see code so imported as module but now everything works fine.

Is there a way for me to test maven plugin so I can try to find why preview has been broken? If I can't preview it then it is like blind shooting views...

[warn]Converting to string: TypedValue

im not sure what is problem.

my logcat shown this log :
[warn]Converting to string: TypedValue{t=0x12/d=0x0 a=2 r=0x7f090028}

and i found in gen R.class :
r=0x7f090028 is lblLeft Textview in BootstrapButton.java

how fix this warn?

BootstrapEditText about android:textAppearance

Thank you for your great work

I wanna change the size of the words in the BootstrapEditText, but it seems that the textAppearance is not work.
Forgive my poor English.
Keep the great work.

Is windowNoTitle really needed in styles.xml?

Hi there

I've been trying to use Android-Bootstrap in my app, the buttons are great! But due to the windowNoTitle attribute in your styles.xml, apps with an ActionBar can't get one due to some code gimmick down the line in Android theming

Is this line necessary?

Thanks

BootstrapCircleThumbnail with ImageView exposed

thanks for a great library!

I'd like to load an image into a BootstrapCircleThumbnail using the Picasso library, but I can't get access to the thumbnail's ImageView which I'd need to pass to Picasso like so:
Picasso.with(inflater.getContext()).load(group.profile_picture_url).into(imgView);

Any way the library could expose the ImageView?

keep up the great work

Error in parsing the layout_width in BootstrapButton

Like this:

<com.beardedhen.androidbootstrap.BootstrapButton
    android:layout_width="120dp"
    android:layout_height="wrap_content"
    android:text="Default"
    bootstrapbutton:bb_icon_left="fa-heart"
    bootstrapbutton:bb_type="default"/>

There will throw an NumberFormatException in parsing the attribute layout_width in the BootstrapButton.

BootstrapCircleThumbnail setImage

i change setImage() on BootstrapCircleThumbnail.java to use universal image loader

public void setImage(int drawable)
    {
        Bitmap bitmap = BitmapFactory.decodeResource(getContext().getResources(), drawable);

        setImage(bitmap);
    }

    public void setImage(Bitmap bitmap){
        float scale = getResources().getDisplayMetrics().density;

        //convert image size to pixels
        int widthPX = (int)((this.imageWidth * scale) + 0.5);
        int heightPX = (int)((this.imageHeight * scale) + 0.5);

        int paddingPX = (int)((this.padding * scale) + 0.5);

        if(this.minimal == false)
        {
            widthPX = widthPX - (paddingPX * 2);
            heightPX = heightPX - (paddingPX * 2);
        }

        Bitmap roundBitmap = ImageUtils.getCircleBitmap(bitmap, widthPX, heightPX);
        image.setImageBitmap(roundBitmap);

        invalidate();
        requestLayout();
    }

BootstrapButton

Hi there,

Just had a few questions:

Why does the BootstrapButton not extend the Button class? Wouldn't this make more sense since people who have existing code with buttons only have to change the layout and all their function calls to their buttons still work.

Perhaps I am missing something?

Thanks.

How can use in gradle?

Hi!
Could I use Android-Bootstrap in gradle build system? like the following?
compile 'com.beardedhen.androidbootstrap:AndroidBootstrap:+'

Gradient Buttons

I'm making a new issue for each feature I added to discuss it because I added too many features at once in my fork. Here are the gradient buttons I added:

2013-12-12 03 28 44
2013-12-12 03 28 21

To use a gradient button, you just set the attribute "gradient" to true in xml. There are gradient square buttons as well, just not pictured

Android support v4 conflict using maven central

Hey there!

Thanks for integrating with maven, but currently, i am getting a duplicate dex file for the android support library. I tried to remove the support dependency in gradle

compile ('com.beardedhen:androidbootstrap:+') {
exclude module: 'support-v4'
}

but I realized after looking into the repo that the android support jar was included directly into the libs directly. Anyway, you could change that so that support-v4 is a dependency vs a included jar?

Bootstrap buttons not streching to fill the requred space

Hi..im using your library in my project.. i want to show 2 buttons side by side and want them to take up the whole width of the screen,ive included your library as you said but the buttons do not stretch to fill the screen. If i try the code with normal android buttons they stretch to fill the space.can u figure out how i can overcome this.
ive tried using android:layout_weight="1" but the buttons just shift to the left and do not strech
1

this is the code of the button part

<LinearLayout
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_weight="10"
    android:gravity="center_horizontal|top"
    android:orientation="horizontal" >

    <com.beardedhen.androidbootstrap.BootstrapButton
        android:id="@+id/b_yes"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_margin="10dp"
        android:gravity="center"
        android:text="YES"
        bootstrapbutton:bb_icon_right="fa-check"
        bootstrapbutton:bb_roundedCorners="true"
        bootstrapbutton:bb_type="success" />

    <com.beardedhen.androidbootstrap.BootstrapButton
        android:id="@+id/b_no"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_margin="10dp"
        android:gravity="center"
        android:text="NO"
        bootstrapbutton:bb_icon_right="fa-times"
        bootstrapbutton:bb_roundedCorners="true"
        bootstrapbutton:bb_type="primary" />
</LinearLayout>

Change from library project to simple jar or zip file

I'm writing an app on the latest version of android and when I import this project and add it as a library to my existing project, there are dependency clashes due to both apps using different versions of android-support-v4.jar

BootstrapEditText hint does not work on android 2.3

I got the hint in BootstrapEditText and it just does not appear in android 2.3

<com.beardedhen.androidbootstrap.BootstrapEditText
android:id="@+id/txtEmail"
android:layout_width="280dp"
android:layout_height="30dp"
android:layout_margin="10dp"
android:gravity="center_horizontal"
android:hint="Email"
android:inputType="textEmailAddress"
bootstrapbutton:be_roundedCorners="true" />

"fill_parent" not working for button

Usually fill_parent should occupy the entire parent width only. But in BootstrapButton it occupy the entire parent width and height

        <com.beardedhen.androidbootstrap.BootstrapButton
            android:id="@+id/registerComplaintGreviance"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_centerHorizontal="true"
            android:orientation="vertical"
            android:text="@string/register_complaint"
            bootstrapbutton:bb_roundedCorners="true"
            bootstrapbutton:bb_type="primary" /> 

Spinner Support

Sry for my english, this is mora a question than an issue, its posible to use something like BootstrapEdittext in a spinner? or woud it be posible implement "BoostrapSpinner" ?

BootstrapCircleThumbnail with a fontawesome icon

It would be nice to display a fontawesome icon in the circle thumbnail.
I started to implement that, but the layout of the component make it difficult (especially because of the dimensionsLabel).

Is this feature planned ?

BootstrapButton created by code not visible

I create button by following code

BootstrapButton button = new BootstrapButton(getApplicationContext());
button.setText("Test");
button.setBootstrapType("default");
button.setLeftIcon("fa-heart");

container.addView(button);

but not visible.

icon or text is still invisible after calling setText or setLeftIcon.

AndroidStudio dependencies

Sorry, I'm a Newbie of Android.
I just add
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.beardedhen:androidbootstrap:1.0.4'
}
but it show
Error:Failed to find: com.beardedhen:androidbootstrap:1.0.4
How can I solve it

Package name

From the src it's com.beardedhen.bbutton
But in the example it called package com.beardedhen.androidbootstrap

BootstrapCircleThumbnail Error parsing XML: unbound prefix

hello
i'm trying to integrate the BootstrapCircleThumbnail on my list item , but when i call it i get this error error: Error parsing XML: unbound prefix.

Here is my code

            <com.beardedhen.androidbootstrap.BootstrapCircleThumbnail
                android:id="@+id/txt_long_desc"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                bootstrap:bct_image="@drawable/ic_taxi_detail_phone"
                bootstrap:bct_size="large" />
     </LinearLayout>

button oddly stretched after updating the library

After updating the library from April to today's version, button suddenly takes up the full screen
2-tile

<LinearLayout 
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical"
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:bootstrapbutton="http://schemas.android.com/apk/res-auto"
    >


    <LinearLayout
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal"
        android:paddingTop="5dp"
        >

        <com.beardedhen.androidbootstrap.BootstrapButton
            android:id="@+id/listButton1"
            android:layout_weight="1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"

            bootstrapbutton:bb_icon_left="fa-list-ol"
            bootstrapbutton:bb_type="default"
            android:paddingLeft="5dp"
            android:paddingRight="5dp"
            android:paddingBottom="5dp"
                       />
        <com.beardedhen.androidbootstrap.BootstrapButton           
            android:layout_weight="1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="@string/listButton2"
            android:layout_gravity="center_horizontal"
            bootstrapbutton:bb_icon_left="fa-road"
            bootstrapbutton:bb_type="default"
            android:paddingBottom="5dp"
            android:paddingRight="5dp"
             />     

    </LinearLayout>

    <ListView
        android:id="@+id/list"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        />
</LinearLayout>

java.lang.NoSuchFieldError

trying to add a bootstrap button and i get this errors
Rendering Problems The following classes could not be instantiated:
- com.beardedhen.androidbootstrap.BootstrapButton (Open Class, Show Exception)
Tip: Use View.isInEditMode() in your custom views to skip code or show sample data when shown in the IDE Exception Details java.lang.NoSuchFieldError: layout   at com.beardedhen.androidbootstrap.BootstrapButton.initialise(BootstrapButton.java:186)   at com.beardedhen.androidbootstrap.BootstrapButton.(BootstrapButton.java:108)   at java.lang.reflect.Constructor.newInstance(Constructor.java:408)   at android.view.LayoutInflater.rInflate_Original(LayoutInflater.java:806)   at android.view.LayoutInflater_Delegate.rInflate(LayoutInflater_Delegate.java:64)   at android.view.LayoutInflater.rInflate(LayoutInflater.java:782)   at android.view.LayoutInflater.rInflate_Original(LayoutInflater.java:809)   at android.view.LayoutInflater_Delegate.rInflate(LayoutInflater_Delegate.java:64)   at android.view.LayoutInflater.rInflate(LayoutInflater.java:782)   at android.view.LayoutInflater.rInflate_Original(LayoutInflater.java:809)   at android.view.LayoutInflater_Delegate.rInflate(LayoutInflater_Delegate.java:64)   at android.view.LayoutInflater.rInflate(LayoutInflater.java:782)   at android.view.LayoutInflater.inflate(LayoutInflater.java:504)   at android.view.LayoutInflater.inflate(LayoutInflater.java:385) Copy stack to clipboard

BootStrapButton click Problem

hi everyone,
i have some issue to use BootStarpButton onclickListner here is my code,when i run the app it's crushed.
BootstrapButton btn2=(BootstrapButton) findViewById(R.id.button2);
//btn2.setText("1111");
btn2.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View arg0) {
            // TODO Auto-generated method stub
            Intent nextscreen=new Intent(getActivity().getApplicationContext(),Mellipage.class);
            startActivity(nextscreen);

        }
    });

if anyone know how can i fix it pleas share it.

BootstrapButton in Relativelayout Error

Using BootstrapButton in Relativelayout with :
android:layout_width="fill_parent"; android:layout_height="wrap_content"
----------------------------------the button take all the space of screen,, it has the same effect of android:layout_width="fill_parent"; android:layout_height="fill_parent"

-----------------------------------but if you use it in LinearLayout, It works fine.

Error inflating class com.beardedhen.androidbootstrap.BootstrapButton

It seems like BootstrapButton try to get textSize after TypeAdapter recycled cause error "Cannot make calls to a recycled instance!".

Related code snippets in BootstrapButton:

finally {
  a.recycle();
}

// blablabla

if (a.getString(R.styleable.BootstrapButton_android_textSize) == null) {
  fontSize = bootstrapSize.getFontSize();
}

Using with ActionBarSherlock error

Using Android-Bootstrap with actionBarSherlock gives this error as soon as bootstrap is added to main project.
error message: actionbarsherlock\res\values\abs__attrs.xml:217: error: Attribute "icon" has already been defined

I renamed the name "icon" in attrs.xml to "bootstrap_icon" to get it to work in my project. This might be something that needs changing

BootstrapButton extends Button

BootstrapButton extends button. One thing I forgot to add is the default sized buttons like "small", "large", etc. I will add it if you decide you want this change.

BootstrapCircleThumbnail is not displayed correctly

hello , i'm tryng to show an image on a BootstrapCircleThumbnail , but the image show's on the top of the thumbs . see the image ,

thumbs

her is my xml code , the image size is : 920x360
<com.beardedhen.androidbootstrap.BootstrapCircleThumbnail
android:id="@+id/img_user"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="5dp"
android:layout_gravity="center_horizontal"
BootstrapCircleThumbnail:bt_image="@drawable/bg_articles_list_row_image_placeholder"
BootstrapCircleThumbnail:bct_size="large"/>

thanks

Styles and Theme

This feature probably needs the most discussion and it really is for the benefit of the developer rather than the user. I added styles for BootstrapButton and BootstrapEditText.
Advantages:

  1. You can specify defaults without going into the class code. For example,
    <style name="BootstrapButton" parent="android:style/Widget.Button"> <item name="android:padding">8dp</item> <item name="android:textSize">14sp</item> <item name="bb_roundedCorners">true</item> </style>

gives each BootstrapButton 8dp padding, 14sp font, and round corners by default. The user can override all these by just doing what he would normally do in the layout xml file. As you can see, custom attributes can be placed in here as well i.e "bb_roundedCorners". It is much easier for the developer to just change settings here than it is to go into the java code and change stuff.

It isn't a huge deal though because there aren't too many defaults to set for BootstrapButtons. But it may make it easier if more widgets get added.

Disadvantage:

  1. The user has to add this to his styles.xml file. He goes to where his theme is located and adds this:
    <item name="bootstrapButtonStyle">@style/BootstrapButton</item> <item name="bootstrapEditTextStyle">@style/BootstrapEditText</item>

So it would end up looking like this after the above 2 lines are added:
<style name="AppTheme" parent="AppBaseTheme"> <item name="bootstrapButtonStyle">@style/BootstrapButton</item> <item name="bootstrapEditTextStyle">@style/BootstrapEditText</item> </style>

I think it's a fair tradeoff, but if more widgets are added to Android Bootstrap with styles, you need to add each one like above. But in the end, it just ends up being a copy and paste by the user, so it will take less than 10 seconds.

I also removed the need for the user to have to download the FontAwesome font and put it into their project. So it evens out kind of. I am 50/50 on this feature. I think it's awesome for developers because it is easier to make changes. But without it, it is nice being able to remove 2 steps for the user in order to use the library (not having to putting font in project and not having to add the styles)

Pushed my experimental branch

Check out the change notes in the readme on my fork. I uploaded a couple screenshots as well. I made a bunch of changes and rewrote some of the base code, so merging would be difficult. Let me know what you think. I was just testing stuff out and ended up changing a bunch of stuff. Here is the fork: https://github.com/theDazzler/Android-Bootstrap

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.