Giter VIP home page Giter VIP logo

navigationtabbar's Introduction


Devlight


NavigationTabBar

Navigation tab bar with colorful interactions.

Android Arsenal       Android       Download       License       Codacy

You can check the sample app here.

Warn

This library is not more supported. 
If you want to add new feature or fix a bug, grab source code and do it. 
If you think your fix or feature would be useful to other developers, 
I can add link of your repository to this README file. 
Thank you for using our libraries.

Download

You can download a .aar from GitHub's releases page.

You can use Gradle:

compile 'devlight.io:navigationtabbar:1.2.5'

Or Maven:

<dependency>
    <groupId>devlight.io</groupId>
    <artifactId>navigationtabbar</artifactId>
    <version>1.2.5</version>
    <type>aar</type>
</dependency>

Or Ivy:

<dependency org='devlight.io' name='navigationtabbar' rev='1.2.5'>
  <artifact name='$AID' ext='pom'></artifact>
</dependency>

Android SDK Version

NavigationTabBar requires a minimum SDK version of 11.

Sample

Parameters

For NTB you can set such parameters as:

  • models:
    allows you to set NTB models, where you set icon and color. Can be set up only via code.

  • behavior:
    allows you to set bottom translation behavior.

  • view pager:
    allows you to connect NTB with ViewPager. If you want your can also set OnPageChangeListener.

  • background color:
    allows you to set background to NTB which automatically set with offset relative to badge gravity and corners radius.

  • model selected icon:
    allows you to set selected icon when current model is active.

  • model title:
    allows you to enable title in you model.

  • model badge:
    allows you to enable badge in you model.

  • use custom typeface on badge:
    allows you to handle set of custom typeface in your badge.

  • title mode:
    allows you to handle mode of the model title show. Can show all or only active.

  • title size:
    allows you to set titles size.

  • scale mode:
    allows you to handle mode of the model icon and title scale.

  • tint mode:
    allows you to enable or disable icon tinting.

  • badge size:
    allows you to set badges size.

  • badge position:
    allows you to set the badge position in you model. Can be: left(25%), center(50%) and right(75%).

  • badge gravity:
    allows you to set the badge gravity in NTB. Can be top or bottom.

  • badge colors:
    allows you to set the badge bg and title colors.

  • typeface:
    allows you to set custom typeface to your title.

  • corners radius:
    allows you to set corners radius of pointer.

  • icon size fraction:
    allows you to set icon size fraction relative to smaller model side.

  • animation duration:
    allows you to set animation duration.

  • inactive color:
    allows you to set inactive icon color.

  • active color:
    allows you to set active icon color.

  • tab bar listener:
    allows you to set listener which triggering on start or on end when you set model index.

  • preview colors:
    allows you to set preview colors, which generate count of models equals to count of colors.

Tips

Creation of models occurs through Builder pattern.
ModelBuilder requires two fields: icon and color. Title, badge title and selected icon is optional.

You can set selected icon. Resize and scale of selected icon equals to original icon.
Orientation automatically detected according to View size.

By default badge bg color is the active model color and badge title color is the model bg color. To reset colors just set AUTO_COLOR value to badge bg and title color.
By default badge sizes and title sizes is auto fit. To reset calculation just set AUTO_SIZE value to badge size and title size.
By default icon size fraction is 0.5F (half of smaller side of NTB model). To reset scale fraction of icon to automatic just put in method AUTO_SCALE value.

If your set ViewPager and enable swipe you can action down on active pointer and do like drag.

Init

Check out in code init:

final NavigationTabBar navigationTabBar = (NavigationTabBar) findViewById(R.id.ntb);
final ArrayList<NavigationTabBar.Model> models = new ArrayList<>();
models.add(
        new NavigationTabBar.Model.Builder(
                getResources().getDrawable(R.drawable.ic_first),
                Color.parseColor(colors[0])
        ).title("Heart")
                .badgeTitle("NTB")
                .build()
);
models.add(
        new NavigationTabBar.Model.Builder(
                getResources().getDrawable(R.drawable.ic_second),
                Color.parseColor(colors[1])
        ).title("Cup")
                .badgeTitle("with")
                .build()
);
models.add(
        new NavigationTabBar.Model.Builder(
                getResources().getDrawable(R.drawable.ic_third),
                Color.parseColor(colors[2])
        ).title("Diploma")
                .badgeTitle("state")
                .build()
);
models.add(
        new NavigationTabBar.Model.Builder(
                getResources().getDrawable(R.drawable.ic_fourth),
                Color.parseColor(colors[3])
        ).title("Flag")
                .badgeTitle("icon")
                .build()
);
models.add(
        new NavigationTabBar.Model.Builder(
                getResources().getDrawable(R.drawable.ic_fifth),
                Color.parseColor(colors[4])
        ).title("Medal")
                .badgeTitle("777")
                .build()
);
navigationTabBar.setModels(models);
navigationTabBar.setViewPager(viewPager, 2);

navigationTabBar.setTitleMode(NavigationTabBar.TitleMode.ACTIVE);
navigationTabBar.setBadgeGravity(NavigationTabBar.BadgeGravity.BOTTOM);
navigationTabBar.setBadgePosition(NavigationTabBar.BadgePosition.CENTER);
navigationTabBar.setTypeface("fonts/custom_font.ttf");
navigationTabBar.setIsBadged(true);
navigationTabBar.setIsTitled(true);
navigationTabBar.setIsTinted(true);
navigationTabBar.setIsBadgeUseTypeface(true);
navigationTabBar.setBadgeBgColor(Color.RED);
navigationTabBar.setBadgeTitleColor(Color.WHITE);
navigationTabBar.setIsSwiped(true);
navigationTabBar.setBgColor(Color.BLACK);
navigationTabBar.setBadgeSize(10);
navigationTabBar.setTitleSize(10);
navigationTabBar.setIconSizeFraction(0.5);

If your models is in badge mode you can set title, hide, show, toggle and update badge title like this:

model.setTitle("Here some title to model");
model.hideBadge();
model.showBadge();
model.toggleBadge();
model.updateBadgeTitle("Here some title like NEW or some integer value");

To enable behavior translation inside CoordinatorLayout when at bottom of screen:

navigationTabBar.setBehaviorEnabled(true);

To deselect active index and reset pointer:

navigationTabBar.deselect();

Other methods check out in sample.

And XML init:

<devlight.io.library.ntb.NavigationTabBar
   android:id="@+id/ntb"
   android:layout_width="match_parent"
   android:layout_height="50dp"
   app:ntb_animation_duration="400"
   app:ntb_preview_colors="@array/colors"
   app:ntb_corners_radius="10dp"
   app:ntb_active_color="#fff"
   app:ntb_inactive_color="#000"
   app:ntb_badged="true"
   app:ntb_titled="true"
   app:ntb_scaled="true"
   app:ntb_tinted="true"
   app:ntb_title_mode="all"
   app:ntb_badge_position="right"
   app:ntb_badge_gravity="top"
   app:ntb_badge_bg_color="#ffff0000"
   app:ntb_badge_title_color="#ffffffff"
   app:ntb_typeface="fonts/custom_typeface.ttf"
   app:ntb_badge_use_typeface="true"
   app:ntb_swiped="true"
   app:ntb_bg_color="#000"
   app:ntb_icon_size_fraction="0.5"
   app:ntb_badge_size="10sp"
   app:ntb_title_size="10sp"/>

XML属性中文详解:

<devlight.io.library.ntb.NavigationTabBar 各属性详解
    全局:
    app:ntb_bg_color="#000"             ntb的背景颜色                可自定义
    app:ntb_active_color="#000"         ntb活动时的图标+标题颜色      可自定义
    app:ntb_inactive_color="#0f0"       ntb不活动时的图标+标题颜色    可自定义
    app:ntb_corners_radius="10dp"       ntb切换时的动画弧度大小       可自定义
    app:ntb_animation_duration="1000"   ntb切换时的动画时间           单位:ms
    图标相关:
    app:ntb_icon_size_fraction="1"      图标所占的大小比例            最佳值:0.5
    标题相关:
    app:ntb_titled="true"               是否显示图标所对应的标题       默认为false
    app:ntb_title_mode="active"         图片所对应的标题显示模式       active:活动时才显示 all:总是显示  PS:app:ntb_titled属性值为 true 时才可用
    app:ntb_title_size="10sp"           设置图标所对应的标题文字大小    请自定义
    勋章相关:
    app:ntb_badged="false"              是否显示勋章                  默认为false
    app:ntb_badge_gravity="top"         勋章的上下位置                top|bottom
    app:ntb_badge_position="right"      勋章的左右位置                left(25%), center(50%) and right(75%)
    app:ntb_badge_bg_color="#ffff0000"  勋章的背景颜色                可自定义
    app:ntb_badge_title_color="#000000" 勋章的标题文字颜色             可自定义 PS:不设置的话默认为切换动画的背景色
    app:ntb_badge_size="12sp"           勋章的标题文字大小             可自定义
    字体相关:
    app:ntb_badge_use_typeface="false"  是否使用自定义字体             默认为false
    app:ntb_typeface="fonts/by3500.ttf" 设置ntb的自定义字体            请将自定义的字体文件放在 asset/fonts 文件夹下
    其他:
    app:ntb_preview_colors="@array/colors"
    app:ntb_scaled="true"
    app:ntb_tinted="true"
    app:ntb_swiped="true"/>

Getting Help

To report a specific problem or feature request, open a new issue on Github.

Xamarin

Thanks to Martijn van Dijk for developing Xamarin bindings library for NavigationTabBar.
Plugin is available on Nuget.

use navbar using materialize css

navbar using materialize css is really easy and would take just assigning right classes to the html tags and it would create a navigation tab bar using its prewritten css and js files. This can be easily used in html pages using downloaded files or cdn links... https://materializecss.com/navbar.html

Credits

Sincere thanks, to portal FAnDroid.info (StartAndroid) who released the review of this library in detail. If you understand the Russian language, then feel free to see the video or read the text version of its great post.

Inspired by:

Sergey Valiukh

Thanks to Valery Nuzhniy for NTB badge design.

Author

Created by Basil Miller - @gigamole

Company

Facebook     Twitter     LinkedIn

Here you can see open source work developed by Devlight LLC.
This and another works is an exclusive property of Devlight LLC.

If you want to use this library in applications which will be available on Google Play, please report us about it or author of the library.

Whether you're searching for a new partner or trusted team for creating your new great product we are always ready to start work with you.

You can contact us via [email protected] or [email protected].
Thanks in advance.

Devlight LLC, 2016
devlight.io

navigationtabbar's People

Contributors

569258yin avatar ac-opensource avatar gigamole avatar ljf1172361058 avatar parasgupta0018 avatar serhiipokrovskyi avatar tucomel 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

navigationtabbar's Issues

random crash

java.lang.NullPointerException: Attempt to invoke virtual method 'boolean android.graphics.Bitmap.isRecycled()' on a null object reference at android.graphics.Canvas.throwIfCannotDraw(Canvas.java:1281) at android.graphics.Canvas.drawBitmap(Canvas.java:1337) at com.gigamole.navigationtabbar.ntb.NavigationTabBar.onDraw(NavigationTabBar.java:1091)

I do not understand why the random error could happen when I use the Fragment on ViewPager. and I use Bitmap that I have downloaded the library ImageRequest of Volley then converted to a Drawable, sometimes can sometimes error as above, even when I replace the existing image on fixed Drawable error sometimes occurs and sometimes succeed

null object reference

When I try to run my code I get this.

I included you library from code

java.lang.NullPointerException: Attempt to invoke virtual method 'boolean android.graphics.Bitmap.isRecycled()' on a null object reference

fields

Hello! Can you turn fields and methods in classes from private to protected, so we can extend your classes and override some features. Thx!

I can't make it show title

I use your NavigationTabBar in my project,But it is not work so better,it can not show title,can you please help me debug it?

There is a part of code about it.

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    app:layout_behavior="@string/appbar_scrolling_view_behavior"
    tools:context="com.bigmercu.qinxinjiajiao.activity.bigmercuActivity"
    tools:showIn="@layout/activity_bigmercu">
    <com.gigamole.library.NavigationTabBar
        android:id="@+id/ntb"
        android:layout_width="match_parent"
        android:layout_height="50dp"
        android:background="@color/colorPrimaryDark"
        app:ntb_animation_duration="400"
        app:ntb_preview_colors="@array/polluted_waves"
        app:ntb_active_color="#ffffff"
        app:ntb_inactive_color="#000000"
        app:ntb_badged="true"
        app:ntb_titled="true"
        app:ntb_title_mode="all"
        app:ntb_badge_position="right"
        app:ntb_badge_gravity="top"
        app:ntb_badge_use_typeface="true"
        android:layout_alignParentBottom="true"
        android:layout_centerHorizontal="true"/>
</RelativeLayout>
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_bigmercu);
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    ButterKnife.bind(this);

    String[] colors = getResources().getStringArray(R.array.default_preview);
    ArrayList<NavigationTabBar.Model> models = new ArrayList<>();
    models.add(new NavigationTabBar.Model(
            getResources().getDrawable(R.drawable.ic_first), Color.parseColor(colors[0]), "首页"));
    models.add(new NavigationTabBar.Model(
            getResources().getDrawable(R.drawable.ic_second), Color.parseColor(colors[1]), "赵老师"));
    models.add(new NavigationTabBar.Model(
            getResources().getDrawable(R.drawable.ic_third), Color.parseColor(colors[2]), "周边家长"));
    models.add(new NavigationTabBar.Model(
            getResources().getDrawable(R.drawable.ic_fourth), Color.parseColor(colors[3]), "消息"));
    models.add(new NavigationTabBar.Model(
            getResources().getDrawable(R.mipmap.me), Color.parseColor(colors[4]), "我"));

    navigationTabBar.setBadgeGravity(NavigationTabBar.BadgeGravity.TOP);
    navigationTabBar.setBadgePosition(NavigationTabBar.BadgePosition.CENTER);
    navigationTabBar.setIsBadged(true);
    navigationTabBar.setIsTitled(true);
    navigationTabBar.setTitleMode(NavigationTabBar.TitleMode.ALL);
    navigationTabBar.setModels(models);

Do you now why?

get position without using view pager

Hi. in this library how can i found whats position of tab without using viewpager? i dont like to use view pager and i want to know current position when user scrolling

About badgeTitle.

I didn't write this sentence-".badgeTitle("***")",but it show on navigation again.could u tell ?And,how can i set one of these tags for each other.

freeze page

Hi all, thats my problem. I use in setOnTabBarSelectedIndexListener. fragment transaction and when open fragment with 1 view in layout, thats all ok, but when open layout with many view, selection page freeze from 0.4 to 2 second, it`s looking wery trouble, explain please what wrong. Thx to all.

can't find the library

i like your libraries , but i can't find the library from dependencies in android studio ,so i can't use it ,is anything wrong?

setIconSizeFraction() missing in NavigationTabBar.java

navigationTabBar.setIconSizeFraction(0.5); in documentation does not work with compile:navigationtabbar1.2.3
setIconSizeFraction() is either missing or the documentation is incorrect and it has been removed/replaced?

The following picture displays the position from where the code is missing:
http://imgur.com/DZJZM4W
This is the code that is missing:
public float getIconSizeFraction() { return mIconSizeFraction; } // To reset scale fraction of icon to automatic just put in method AUTO_SCALE value public void setIconSizeFraction(final float iconSizeFraction) { mIconSizeFraction = iconSizeFraction; requestLayout(); }

Thank you for making such a great resource!

Setting default Icon

i want to set a coloured icon , but it fills the default color in the icon. i want to keep my icon as it is coloured without setting any colour through nt_inactive_color .

Access modifiers

Hello! Can you turn fields and methods in classes from private to protected, so we can extend your classes and override some features. Thx!

Disable index selection

when i open the activity model index will be active. for an example if i set models5.setModelIndex(1,true); the first will be active. i need to disable this. when i open the activity all index should be disable and if i select one need to active that select one.is it possible?

get click on button when it is selected too

I am getting NVt button click Using navigationTabBar.setOnTabBarSelectedIndexListener working good but when i going to click on pre-selected button it didnt show its postion how to get it I need to open Dialog on Click, first time click it work but next time I have change selected Button and again come to same button to open dialog pls help

Icons drawn lose their quality

In our project, we have 4 tabs, each tab icon has 2 states (active and inactive). So we create totally 8 icon images for those tabs. For each image, we generate images for different sizes like this:

  • xxxhdpi: 128 x 128 px
  • xxhdpi: 96 x 96 px
  • xhdpi: 64 x 64 px
  • hdpi: 48 x 48 px
  • mhdpi: 32 x 32 px

However, when the app launches, the tab icons lose their quality:

alt tag

Do you have any idea how to fix this?

Code:

models.add(
                new NavigationTabBar.Model.Builder(
                        getResources().getDrawable(R.drawable.grey_plane),
                        Color.parseColor(Constant.COLOR_TRANSPARENT)
                ).selectedIcon(getResources().getDrawable(R.drawable.purple_plane_fulfill)).title("Flights")
                        .build()
        );
        models.add(
                new NavigationTabBar.Model.Builder(
                        getResources().getDrawable(R.drawable.grey_bed),
                        Color.parseColor(Constant.COLOR_TRANSPARENT)
                ).selectedIcon(getResources().getDrawable(R.drawable.purple_bed_fulfill)).title("Hotels")
                        .build()
        );
        models.add(
                new NavigationTabBar.Model.Builder(
                        getResources().getDrawable(R.drawable.grey_history),
                        Color.parseColor(Constant.COLOR_TRANSPARENT)
                ).selectedIcon(getResources().getDrawable(R.drawable.purple_history_fulfill)).title("Activity")
                        .build()
        );
        models.add(
                new NavigationTabBar.Model.Builder(
                        getResources().getDrawable(R.drawable.grey_user),
                        Color.parseColor(Constant.COLOR_TRANSPARENT)
                ).selectedIcon(getResources().getDrawable(R.drawable.purple_user_fulfill)).title("Me")
                        .build()
        );
        navigationTabBar.setModels(models);
        navigationTabBar.setViewPager(viewPager, 1);
        navigationTabBar.setTitleMode(NavigationTabBar.TitleMode.ALL);
        navigationTabBar.setIsTitled(true);

in xml

 <com.gigamole.navigationtabbar.ntb.NavigationTabBar
            android:id="@+id/ntb"
            android:layout_width="match_parent"
            android:layout_height="?attr/actionBarSize"
            android:layout_marginTop="-8dp"
            app:ntb_animation_duration="200"
            app:ntb_active_color="@color/colorPrimary"
            app:ntb_inactive_color="@color/date_picker_text_normal"
            app:ntb_badged="true"
            app:ntb_scaled="false"
            app:ntb_title_mode="all"
            app:ntb_titled="true"
            app:ntb_typeface="fonts/Gotham-Book.otf" />

Cannot get badges to show

Hi,

Otherwise the NTB works like a charm, but I can't get the badges to show at all...

Here's my layout xml:
`

<com.gigamole.navigationtabbar.ntb.NavigationTabBar
    android:id="@+id/main_ntb"
    android:layout_width="match_parent"
    android:layout_height="50dp"
    android:layout_alignParentTop="true"
    app:ntb_animation_duration="200"
    app:ntb_active_color="#ffffff"
    app:ntb_inactive_color="@color/grey"
    app:ntb_badged="true"
    app:ntb_titled="false"
    app:ntb_scaled="false"
    app:ntb_tinted="true"
    app:ntb_badge_position="right"
    app:ntb_badge_gravity="bottom"
    app:ntb_badge_bg_color="@color/theme_red"
    app:ntb_badge_title_color="#ffffff"
    app:ntb_swiped="true"
    app:ntb_bg_color="@color/dark_grey"
    app:ntb_badge_size="10sp"
    app:ntb_title_size="10sp" />

<io.altru.lack.components.NonSwipeableViewPager
    android:id="@+id/viewpager"
    android:layout_width="match_parent"
    android:layout_height="0dp"
    android:layout_below="@+id/main_ntb"
    android:layout_alignParentBottom="true"
    android:background="@color/lightgrey" />

`

Here's the code for setting up my NTB:

navigationTabBar = (NavigationTabBar) findViewById(R.id.main_ntb);

final ArrayList<NavigationTabBar.Model> models = new ArrayList<>();

IconDrawable browse = new IconDrawable(this, TypiconsIcons.typcn_home_outline).sizeDp(40);

IconDrawable create = new IconDrawable(this, TypiconsIcons.typcn_camera).sizeDp(40);

IconDrawable lists = new IconDrawable(this, TypiconsIcons.typcn_pin).sizeDp(40);

models.add(
new NavigationTabBar.Model.Builder(browse, getResources().getColor(R.color.theme_accent))
.build()
);

models.add(
new NavigationTabBar.Model.Builder(create, getResources().getColor(R.color.theme_accent))
.build()
);

models.add(
new NavigationTabBar.Model.Builder(lists, getResources().getColor(R.color.theme_accent))
.badgeTitle("Wee")
.build()
);

navigationTabBar.setModels(models);

navigationTabBar.setViewPager(viewPager, 0);

navigationTabBar.setIsBadged(true);

And finally, here's the code where I try to show the badge (pretty much copied from the sample app):

navigationTabBar.postDelayed(new Runnable() {
@OverRide
public void run() {
final NavigationTabBar.Model model = navigationTabBar.getModels().get(0);
Log.v(TAG, "Is badge showing before: " + model.isBadgeShowed());
model.showBadge();
Log.v(TAG, "Is badge showing after: " + model.isBadgeShowed());
}
}, 500);

In the last code snippet, the model.isBadgeShowed() returns false on both calls, both before and after calling model.showBadge()

Any help?

Slidable?

Is tab item able to fix width and scrollable if no more space left?

Disable icon scale animation

how can I clear icon animation(scale),by the way,how to use custom animation instead default,just like the last image in readMe,and,there is a white space on badge,it can be dismiss when badge dismiss?
image

adjust scaling

i think it would be good if we can configure scaling, like 2x, 3x etc

problem in navbar

Hi tanx for your good lib
my english is not good sorry for that
i have a problem i have add change possison in your code for example i want to start a progressbar
when i am in tab 1 but it start in tab 2 and tab 1 what is the problem ?
if(position==0){
new JSONAsyncTask().execute("http://microblogging.wingnity.com/JSONParsingTutorial/jsonActors");
ArrayList listMockData = new ArrayList();
String[] images = getResources().getStringArray(R.array.images_array);
String[] headlines = getResources().getStringArray(R.array.headline_array);

                for (int i = 0; i < images.length; i++) {
                    ListItem newsData = new ListItem();
                    newsData.setUrl(images[i]);
                    newsData.setHeadline(headlines[i]);
                    newsData.setReporterName("Pankaj Gupta");
                    newsData.setDate("May 26, 2013, 13:35");
                    listMockData.add(newsData);
                }
                ArrayList<ListItem> listData = listMockData;

                final ListView listView = (ListView) findViewById(R.id.custom_list);
                listView.setAdapter(new CustomListAdapter(Main.this, listData));
                listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {

                    @Override
                    public void onItemClick(AdapterView<?> a, View v, int position, long id) {
                        ListItem newsData = (ListItem) listView.getItemAtPosition(position);
                        Toast.makeText(Main.this, "Selected :" + " " + newsData, Toast.LENGTH_LONG).show();
                    }
                });
            }

Different Fragment item each item view and image

Thanks in advance for responding to bug I reported yesterday. and can you gives an example of the use of NTB with 4 Fragment different? because I have tried but to no avail, oh I want to create a navigation reference to NTB like Instagram. and whether the icon NTB may directly input in the form Bitmap without having at Convert to BitmapDrawable?

badge size

for me, the badge is too small, could you make function about its size?
thx, btw great lib :)

menu without a title

I am a Chinese but English is not very good, I use your library, but the menu does not have a title, I try to use your demo,it dose not have a title too. I don't know what's wrong?

how can I change the color of the badges?

Could not find this customization option.

Obviously white colored badges can only make sense on dark themed apps like the example that you created, so that limitation makes the badge feature useless for a lot of people.

I think if implementing a custom color is dificult you could at least make an option for red badges, which are the default for most apps

Unable to build source after cloning. Help needed to set up the source

Error:A problem occurred configuring root project 'NavigationTabBar'.

Could not resolve all dependencies for configuration ':classpath'.
Could not resolve com.github.dcendents:android-maven-gradle-plugin:1.3.
Required by:
:NavigationTabBar:unspecified
> Could not resolve com.github.dcendents:android-maven-gradle-plugin:1.3.
> Could not get resource 'https://jcenter.bintray.com/com/github/dcendents/android-maven-gradle-plugin/1.3/android-maven-gradle-plugin-1.3.pom'.
> Could not GET 'https://jcenter.bintray.com/com/github/dcendents/android-maven-gradle-plugin/1.3/android-maven-gradle-plugin-1.3.pom'.
> Connection to http://127.0.0.1:8888 refused
Could not resolve com.jfrog.bintray.gradle:gradle-bintray-plugin:1.1.
Required by:
:NavigationTabBar:unspecified
> Could not resolve com.jfrog.bintray.gradle:gradle-bintray-plugin:1.1.
> Could not get resource 'https://jcenter.bintray.com/com/jfrog/bintray/gradle/gradle-bintray-plugin/1.1/gradle-bintray-plugin-1.1.pom'.
> Could not GET 'https://jcenter.bintray.com/com/jfrog/bintray/gradle/gradle-bintray-plugin/1.1/gradle-bintray-plugin-1.1.pom'.
> Connection to http://127.0.0.1:8888 refused

how to work under api 23

Error:(4) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button.Inverse'.
Error:(33) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Button.Colored'.

Oddities in sample app

Hi,

I noticed your demo app does something that I'd not really expect:

    @Override
    protected void onDestroy() {
        super.onDestroy();
        System.runFinalization();
        Runtime.getRuntime().gc();
        System.gc();
    }

Is there any reason for forcing this in your app?

button borders

i think it would be good to have some options for tabbar buttons borders (such as colors, width, smh else maybe)

onConfigurationChanged ui bug

hi, thanks for this lib, i see a bug when the navigationtabbar is in the bottom of the activity. When the activity is not recreated. In orientation changed the item in navigation bar is not correctly selected, the color not appear correctly over the item and sometimes the item selected is landscape is different that the item selected in portrait.

Disable click on Tabs

Hi, how can i implementing disable click on tabs? my solution doesnt work

navigation_tab_bar.setOnClickListener(null);
navigation_tab_bar.setOnTabBarSelectedIndexListener(new NavigationTabBar.OnTabBarSelectedIndexListener() {
    @Override
    public void onStartTabSelected(NavigationTabBar.Model model, int index) {
        return;
    }
    @Override
    public void onEndTabSelected(NavigationTabBar.Model model, int index) {
        return;
    }
});

java.lang.NullPointerException: Attempt to invoke virtual method 'boolean android.graphics.Bitmap.isRecycled()' on a null object reference

I put the layout file inside the TopHorizontalNtbActivity class AppBarLayout that copy out, and then on the wrong.
but ,I don't have the control.Is it because of this?

  java.lang.NullPointerException: Attempt to invoke virtual method 'boolean android.graphics.Bitmap.isRecycled()' on a null object reference
                                                                          at android.graphics.Canvas.throwIfCannotDraw(Canvas.java:1269)
                                                                          at android.graphics.Canvas.drawBitmap(Canvas.java:1325)
                                                                          at com.gigamole.navigationtabbar.ntb.NavigationTabBar.onDraw(NavigationTabBar.java:1091)
                                                                          at android.view.View.draw(View.java:16178)
                                                                          at android.view.View.buildDrawingCacheImpl(View.java:15474)
                                                                          at android.view.View.buildDrawingCache(View.java:15335)
                                                                          at android.view.View.draw(View.java:15941)
                                                                          at android.view.ViewGroup.drawChild(ViewGroup.java:3609)
                                                                          at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3399)
                                                                          at android.view.View.updateDisplayListIfDirty(View.java:15169)
                                                                          at android.view.View.draw(View.java:15948)
                                                                          at android.view.ViewGroup.drawChild(ViewGroup.java:3609)
                                                                          at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3399)
                                                                          at android.view.View.draw(View.java:16181)
                                                                          at android.view.View.updateDisplayListIfDirty(View.java:15174)
                                                                          at android.view.View.draw(View.java:15948)
                                                                          at android.view.ViewGroup.drawChild(ViewGroup.java:3609)
                                                                          at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3399)
                                                                          at android.view.View.draw(View.java:16181)
                                                                          at android.view.View.updateDisplayListIfDirty(View.java:15174)
                                                                          at android.view.View.draw(View.java:15948)
                                                                          at android.view.ViewGroup.drawChild(ViewGroup.java:3609)
                                                                          at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3399)
                                                                          at android.view.View.updateDisplayListIfDirty(View.java:15169)
                                                                          at android.view.View.draw(View.java:15948)
                                                                          at android.view.ViewGroup.drawChild(ViewGroup.java:3609)
                                                                          at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3399)
                                                                          at android.view.View.updateDisplayListIfDirty(View.java:15169)
                                                                          at android.view.View.draw(View.java:15948)
                                                                          at android.view.ViewGroup.drawChild(ViewGroup.java:3609)
                                                                          at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3399)
                                                                          at android.view.View.updateDisplayListIfDirty(View.java:15169)
                                                                          at android.view.View.draw(View.java:15948)
                                                                          at android.view.ViewGroup.drawChild(ViewGroup.java:3609)
                                                                          at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3399)
                                                                          at android.view.View.updateDisplayListIfDirty(View.java:15169)
                                                                          at android.view.View.draw(View.java:15948)
                                                                          at android.view.ViewGroup.drawChild(ViewGroup.java:3609)
                                                                          at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3399)
                                                                          at android.view.View.draw(View.java:16181)
                                                                          at com.android.internal.policy.PhoneWindow$DecorView.draw(PhoneWindow.java:2690)
                                                                          at android.view.View.updateDisplayListIfDirty(View.java:15174)
                                                                          at android.view.ThreadedRenderer.updateViewTreeDisplayList(ThreadedRenderer.java:281)
                                                                          at android.view.ThreadedRenderer.updateRootDisplayList(ThreadedRenderer.java:287)
                                                                          at android.view.ThreadedRenderer.draw(ThreadedRenderer.java:322)
                                                                          at android.view.ViewRootImpl.draw(ViewRootImpl.java:2615)
                                                                          at android.view.ViewRootImpl.performDraw(ViewRootImpl.java:2434)
                                                                          at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2067)
                                                                          at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1107)
                                                                          at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:6013)
                                                                          at android.view.Choreographer$CallbackRecord.run(Choreographer.java:858)
                                                                          at android.view.Choreographer.doCallbacks(Choreographer.java:670)
                                                                          at android.view.Choreographer.doFrame(Choreographer.java:606)
                                                                          at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:844)
                                                                          at android.os.Handler.handleCallback(Handler.java:739)
                                                                          at android.os.Handler.dispatchMessage(Handler.java:95)
                                                                          at android.os.Looper.loop(Looper.java:148)
                                                                          at android.app.ActivityThread.main(ActivityThread.java:5417)
                                                                          at java.lang.reflect.Method.invoke(Native Method)
                                                                          at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
                                                                          at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)

Error android 6.0.1 on nexus 5

java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.gigamole.navigationtabbar/com.gigamole.navigationtabbar.MainActivity}: java.lang.ClassNotFoundException: Didn't find class "com.gigamole.navigationtabbar.MainActivity" on path: DexPathList[[zip file "/data/app/com.gigamole.navigationtabbar-1/base.apk"],nativeLibraryDirectories=[/data/app/com.gigamole.navigationtabbar-1/lib/arm, /vendor/lib, /system/lib]]
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2327)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476)
at android.app.ActivityThread.-wrap11(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5417)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.gigamole.navigationtabbar.MainActivity" on path: DexPathList[[zip file "/data/app/com.gigamole.navigationtabbar-1/base.apk"],nativeLibraryDirectories=[/data/app/com.gigamole.navigationtabbar-1/lib/arm, /vendor/lib, /system/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
at android.app.Instrumentation.newActivity(Instrumentation.java:1067)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2317)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476) 
at android.app.ActivityThread.-wrap11(ActivityThread.java) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344) 
at android.os.Handler.dispatchMessage(Handler.java:102) 
at android.os.Looper.loop(Looper.java:148) 
at android.app.ActivityThread.main(ActivityThread.java:5417) 
at java.lang.reflect.Method.invoke(Native Method) 
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616) 
Suppressed: java.lang.ClassNotFoundException: Didn't find class "com.gigamole.navigationtabbar.MainActivity" on path: DexPathList[[dex file "/data/data/com.gigamole.navigationtabbar/files/instant-run/dex/slice-support-annotations-23.4.0_e29451ecbafa43ab8360f08f2358b7f7ded12169-classes.dex", dex file "/data/data/com.gigamole.navigationtabbar/files/instant-run/dex/slice-internal_impl-23.4.0_ed6077c7ae36854a156f5057e37ddfc5539f0265-classes.dex", dex file "/data/data/com.gigamole.navigationtabbar/files/instant-run/dex/slice-com.android.support-support-vector-drawable-23.4.0_590f3995813849c4d48fcd3942188e26f8f68645-classes.dex", dex file "/data/data/com.gigamole.navigationtabbar/files/instant-run/dex/slice-com.android.support-support-v4-23.4.0_f0ff20939018b86d3213b795982102f39afece23-classes.dex", dex file "/data/data/com.gigamole.navigationtabbar/files/instant-run/dex/slice-com.android.support-recyclerview-v7-23.4.0_90472ccc4c6fbfca7e6511b836cd08a98fd2e4cb-classes.dex", dex file "/data/data/com.gigamole.navigationtabbar/files/instant-run/dex/slice-com.android.support-design-23.4.0_ab15a4269ad22fa06be63b7923f8a4cfcce35a2f-classes.dex", dex file "/data/data/com.gigamole.navigationtabbar/files/instant-run/dex/slice-com.android.support-appcompat-v7-23.4.0_8bda3a59524d420ce46af580679524efcc621bf5-classes.dex", dex file "/data/data/com.gigamole.navigationtabbar/files/instant-run/dex/slice-com.android.support-animated-vector-drawable-23.4.0_fc68d0f0347c6fa313857b324630255d52caed51-classes.dex"],nativeLibraryDirectories=[/data/app/com.gigamole.navigationtabbar-1/lib/arm, /vendor/lib, /system/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
at com.android.tools.fd.runtime.IncrementalClassLoader$DelegateClassLoader.findClass(IncrementalClassLoader.java:90)
at com.android.tools.fd.runtime.IncrementalClassLoader.findClass(IncrementalClassLoader.java:62)
at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
... 12 more
Suppressed: java.lang.ClassNotFoundException: com.gigamole.navigationtabbar.MainActivity
at java.lang.Class.classForName(Native Method)
at
java.lang.BootClassLoader.findClass(ClassLoader.java:781)

Populate Tabs

How do you populate the tabs... please i need assistance

Vertical NTB ,title dosen't show.

I added a NTB and the title is enabled but it doesn't show.
image

When i put the NTB on a horizontal position all is good ,does NTB not support title in vertical position ?
And another thing , i have many models ,how can i make the NTB scrollable so i can see all of them and just when i click a model to change the fragment from the view pager, is this supported ( i mean scrolling through the items of the NTB )?

Thank you :)

Title Only

Why not can we set NavigationTabBar title-only ?

setIconSizeFraction() float to double conversion error

When I try to set the following:

navigationTabBar.setIconSizeFraction(0.5);

I get the error:

Error:(115, 46) error: incompatible types: possible lossy conversion from double to float

Why is this? I have just updated my gradle to use version 1.2.4

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.