Coder Social home page Coder Social logo

10clouds / fluidbottomnavigation-android Goto Github PK

View Code? Open in Web Editor NEW
329.0 18.0 45.0 762 KB

Fluid Bottom Navigation library for Android

Home Page: https://10clouds.com/

License: MIT License

Kotlin 97.37% Java 2.63%
bottomnavigation bottombar bottomnavigationview bottomnavigationbar android android-library

fluidbottomnavigation-android's Introduction

Fluid Bottom Navigation Build Status Download library

Sample

Sample Fluid Bottom Navigation

Installation

Use the JitPack package repository.

Add jitpack.io repository to your root build.gradle file:

allprojects {
    repositories {
        ...
        maven { url 'https://jitpack.io' }
    }
}

Next add library to your project build.gradle file: Gradle:

implementation 'com.github.10clouds:FluidBottomNavigation-android:{last_release_version}'

Usage

Place FluidBottomNavigation in your layout:

<com.tenclouds.fluidbottomnavigation.FluidBottomNavigation
            android:id="@+id/fluidBottomNavigation"
            android:layout_height="wrap_content"
            android:layout_width="0dp" />

then set navigation items to component:

fluidBottomNavigation.items =
                listOf(
                        FluidBottomNavigationItem(
                                getString(R.string.news),
                                ContextCompat.getDrawable(this, R.drawable.ic_news)),
                        FluidBottomNavigationItem(
                                getString(R.string.inbox),
                                ContextCompat.getDrawable(this, R.drawable.ic_inbox)),
                        FluidBottomNavigationItem(
                                getString(R.string.calendar),
                                ContextCompat.getDrawable(this, R.drawable.ic_calendar)),
                        FluidBottomNavigationItem(
                                getString(R.string.chat),
                                ContextCompat.getDrawable(this, R.drawable.ic_chat)),
                        FluidBottomNavigationItem(
                                getString(R.string.profile),
                                ContextCompat.getDrawable(this, R.drawable.ic_profile)))

Application with example is in app folder

Customization

You can customize component from XML layout file, using attributes:

app:accentColor="@color/accentColor"
app:backColor="@color/backColor"
app:iconColor="@color/iconColor"
app:iconSelectedColor="@color/iconSelectedColor"
app:textColor="@color/textColor"

or from Java/Kotlin code:

fluidBottomNavigation.accentColor = ContextCompat.getColor(this, R.color.accentColor)
fluidBottomNavigation.backColor = ContextCompat.getColor(this, R.color.backColor)
fluidBottomNavigation.textColor = ContextCompat.getColor(this, R.color.textColor)
fluidBottomNavigation.iconColor = ContextCompat.getColor(this, R.color.iconColor)
fluidBottomNavigation.iconSelectedColor = ContextCompat.getColor(this, R.color.iconSelectedColor)

Library made by Jakub Jodełka

fluidbottomnavigation-android's People

Contributors

jakubjodelka 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

fluidbottomnavigation-android's Issues

latest android studio

since android studio's new version (electric eel) came,it's build structure has been changed and now it doesn't show the option of root build.gradle

programmatically set selected item

Hi
I need to set one of the items as default selected when the view is shown and I need to change selected item inside code.
How do I programmatically set selected item ?

Gradle fail

I tried to add the library to my project:

my gradle file is like that:

` apply plugin: 'com.android.application'

android {
	compileSdkVersion 27
	defaultConfig {
		applicationId "com.package.myAppname"
		minSdkVersion 15
		targetSdkVersion 27
		versionCode 1
		versionName "1.0"
		testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
	}
	buildTypes {
		release {
			minifyEnabled false
			proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
		}
	}
}

dependencies {
	implementation fileTree(dir: 'libs', include: ['*.jar'])
	implementation 'com.android.support:appcompat-v7:27.1.1'
	implementation 'com.android.support.constraint:constraint-layout:1.1.3'
	implementation 'com.tenclouds.fluidbottomnavigation:fluid-bottom-navigation:1.1'
	testImplementation 'junit:junit:4.12'
	androidTestImplementation 'com.android.support.test:runner:1.0.2'
	androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'

}

`

but I have this message:
Failed to resolve: com.tenclouds

Any suggestion ?

Keep title when selecting tabs

Hi there, I was testing your library and really like it. I was just wondering if there's a way to have an attribute for keeping titles visible by default while navigating through tabs. I'd really appreciate it. Thanks in advance for any response!

Support for java

Can this library support with java?
or
Is any separate java lib available?

Cannot change Bottom Navigation Height

Bottom Navigation is too small. Cannot change its height.

I've tried changing the properties:
android:layout_height="wrap_content"
and this one as well:
app:height="67dp"

Also tried changing icon size but no effect.

can we use it with Nav controller ?

val navView: BottomNavigationView = findViewById(R.id.nav_view)

val navController = findNavController(R.id.nav_host_fragment)

navView.setupWithNavController(navController)

Can we use it in this way ?

setIconSelectedColor is not working

I have successfully integrated this library into my Android(Java) application and now I want to change the color of the icon upon selecting any tab. By far I have done this but it's not working:

fluidBottomNavigation.setOnTabSelectedListener(
                new OnTabSelectedListener() {
                    @Override
                    public void onTabSelected(int i) {
                        Fragment fragment = null;
                        switch (i) {
                            case 0:
                                fragment = new HomeFragment();
                                fluidBottomNavigation.setIconSelectedColor(R.drawable.ic_home_active);
                                break;
                            case 1:
                                fragment = new TicketsFragment();
                                fluidBottomNavigation.setIconSelectedColor(R.drawable.icon_tickects_active);
                                break;

                            case 2:
                                fluidBottomNavigation.setIconSelectedColor(R.drawable.icon_kanz_active);
                                fragment = new KanzFragment();
                                break;

                            case 3:
                                fluidBottomNavigation.setIconSelectedColor(R.drawable.icon_favorites_active);
                                fragment = new FavoriteFragment();
                                break;

                            case 4:
                                fluidBottomNavigation.setIconSelectedColor(R.drawable.icon_carts_active);
                                fragment = new CartFragment();
                                break;
                        }

                        //replacing the fragment
                        if (fragment != null) {
                            FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
                            ft.addToBackStack(null);
                            ft.replace(R.id.content_frame, fragment);
                            ft.commit();
                        }

                    }
                }
        );

```Been stuck on this for a while now.

shadow on top

by adding elevation, and stroke on "top" drawable , can u add better solution for shadow?

Screenshot_20201219_112409_com tenclouds fluidbottomnavigationexample

Warning from Android Studio,

I would love to be able to use it in an Android project but when compiling in Android Studio I got this Warning message:
"API 'variant.getJavaCompile()' is obsolete and has been replaced with 'variant.getJavaCompileProvider()' . It will be removed at the end of 2019"

Do you think you might upload a newer version? Cause if so I would be so grateful!
Thanks so much!

back color is not working

I am trying to change back color from white to some other color, its not working. Please check and let me know..

Notification count

Hi there, I was testing your library and really like it. I thought it might be a feature to add notification count. I really appreciate it. Thanks in advance for the reply!
image

Animation stuttering when switching between tabs fastly

animation-stuttering

Device: OnePlus 3T
System: 8.0.0 (reproducible on every emulator tested api 25,26,27)

Possible solution:
Deselect animation should start only after select animation or somehow blend animation to start from another state than selected/deselected

Change Animation

change animation if it's possible, changing select or deselect animation easily

How to use this library in android java application

I have imported this library and write down java code for fluidBottomNavigation. But it does not show in activity after the run.Below is my code.

fluidBottomNavigation = findViewById(R.id.fluidBottomNavigation);

    fluidBottomNavigation.setAccentColor(ContextCompat.getColor(this, R.color.colorPrimaryDark));
    fluidBottomNavigation.setBackColor(ContextCompat.getColor(this, R.color.colorPrimaryDark));
    fluidBottomNavigation.setTextColor(ContextCompat.getColor(this, R.color.colorPrimaryDark));
    fluidBottomNavigation.setIconColor(ContextCompat.getColor(this, R.color.colorPrimary));
    fluidBottomNavigation.setIconSelectedColor(ContextCompat.getColor(this, R.color.color_green));
    fluidBottomNavigationItems.add(new FluidBottomNavigationItem(
            getString(R.string.str_add_client),
            ContextCompat.getDrawable(this, R.drawable.ic_call)));

    fluidBottomNavigationItems.add(new FluidBottomNavigationItem(
            getString(R.string.str_add_client),
            ContextCompat.getDrawable(this, R.drawable.ic_about)));

    fluidBottomNavigationItems.add(new FluidBottomNavigationItem(
            getString(R.string.str_add_client),
            ContextCompat.getDrawable(this, R.drawable.ic_calendar)));

    fluidBottomNavigationItems.add(new FluidBottomNavigationItem(
            getString(R.string.str_add_client),
            ContextCompat.getDrawable(this, R.drawable.ic_change_password)));

    fluidBottomNavigationItems.add(new FluidBottomNavigationItem(
            getString(R.string.str_add_client),
            ContextCompat.getDrawable(this, R.drawable.ic_delete)));

Latest version

Can you add the latest version of the Bottom Navigation

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.