Giter VIP home page Giter VIP logo

chip-navigation-bar's People

Contributors

dh-46 avatar dhina17 avatar ismaeldivita avatar jagaryousef 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

chip-navigation-bar's Issues

Active menu

I have following menu file but android:enabled="true" is not working (I mean by default when I open my app it is not active)

<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
    <item
        android:id="@+id/home"
        android:icon="@drawable/abc_vector_test"
        android:title="Home"
        android:enabled="true"
        app:cnb_iconColor="@color/home" />
    <item
        android:id="@+id/activity"
        android:icon="@drawable/ic_launcher_foreground"
        android:title="@string/services"
        app:cnb_iconColor="@color/services" />
    <item
        android:id="@+id/favorites"
        android:icon="@android:drawable/arrow_down_float"
        android:title="@string/orders"
        app:cnb_iconColor="@color/orders" />
    <item
        android:id="@+id/settings"
        android:icon="@android:drawable/arrow_up_float"
        android:title="@string/settings"
        app:cnb_iconColor="@color/settings" />
</menu>

Expand & Collapse animation

Thanks for a great library.

I am tring to achiving something similar to like this.

I have implemented it but navigation bar didn't animated.

Can you please help me out.

Thanks

Add Real fragments

How to Add fragments instead of colors
when click on chip i want to add fragment in container like that

or add fragments in arraylist and pass to chip navigation bar
ArrayList fragList = new ArrayList<>();
fragList.add(new firstFragement());
4 more.

please look in to it

Unable to Install in my Java Project

    implementation 'androidx.legacy:legacy-support-v4:1.0.0'
    implementation 'org.jetbrains.kotlin:kotlin-stdlib:1.3.72'

I have imported project successfully
And yet cant use app:cnb_menuResource in my XML file.

Android max API 30
min API level 23

Sync with Gradle and cleared caches and restarted no use.

OnItemSelctedListener Java

I am not sure what I have to write in the OnItemSelctedListener in Java can you send me an Example sir?

This is a Part of my Current Code what do it Need to Change? i want to open an New Actvity on Click Item

public class MainActivity extends AppCompatActivity {

ChipNavigationBar chipNavigationBar;


@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main_test);

    chipNavigationBar = findViewById(R.id.menu);

    chipNavigationBar.setOnItemSelectedListener(new ChipNavigationBar.OnItemSelectedListener() {

        @Override
        public void onItemSelected(int id) {
           Toast.makeText(MainActivity.this, "Test", Toast.LENGTH_SHORT).show();
        }
    });

}

SetItemSelected has no effect in Java

I am trying to init it with a view pager so I need to set the selected item when fragments are selected in the view pager but mbn.setItemSelected(0, true); has no effect and no items are selected.

menu items cannot be deselected.

chipNavigationBar.setItemSelected(getSelectedItemId, false)

trying to use this method to deselect a particular item . But it doesn't work

Item Menu not working in kotlin new version with view binding

click Menu not working please how to fix this issue

XML

<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout 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"
    tools:context=".ui.MainActivity">

    <FrameLayout
        android:id="@+id/fragmentLayout"
        android:layout_width="match_parent"
        android:layout_height="0dp"
        app:layout_constraintBottom_toTopOf="@+id/bottomMenu"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent" />

    <com.ismaeldivita.chipnavigation.ChipNavigationBar
        android:id="@+id/bottomMenu"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        app:cnb_menuResource="@menu/bottom_menu"
        app:cnb_orientationMode="horizontal"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintStart_toStartOf="parent"/>

</androidx.constraintlayout.widget.ConstraintLayout>

Kotlin

class MainActivity : AppCompatActivity() {
    
    private val binding : ActivityMainBinding by lazy {
        ActivityMainBinding.inflate(layoutInflater)
    }

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)
        setupFragment(PlanningFragment())
        setupNavigation()
    }

    private fun setupNavigation() {
        with(binding) {
            bottomMenu.setItemSelected(R.id.home)
            bottomMenu.setOnItemSelectedListener {
                when (it) {
                    R.id.menu_planing -> setupFragment(PlanningFragment())
                    R.id.menu_notes -> setupFragment(NotesFragment())
                    R.id.menu_link -> setupFragment(LinkFragment())
                }
            }
        }
    }

    private fun setupFragment(fragment : Fragment) {
        val transaction = supportFragmentManager.beginTransaction()
        transaction.replace(R.id.fragmentLayout, fragment)
        transaction.commit()
    }
}

Button Error

When I run the application it works with no error. I have 4 buttons in my chip navigation bar. When I click on the first three buttons it doesn't click on the button that I clicked, it automatically clicks the last button. How can I fix that bug? (I'm working with Java)

W/ActivityThread: handleWindowVisibility: no activity for token android.os.BinderProxy@fa524d7
W/System: A resource failed to call close.
W/System: A resource failed to call close.
D/EGL_emulation: eglMakeCurrent: 0xe6f85300: ver 2 0 (tinfo 0xe6f832c0)
D/EGL_emulation: eglMakeCurrent: 0xe6f85300: ver 2 0 (tinfo 0xe6f832c0)
I/chatty: uid=10086(com.example.quitter) RenderThread identical 2 lines
D/EGL_emulation: eglMakeCurrent: 0xe6f85300: ver 2 0 (tinfo 0xe6f832c0)
D/EGL_emulation: eglMakeCurrent: 0xe6f85300: ver 2 0 (tinfo 0xe6f832c0)
W/ActivityThread: handleWindowVisibility: no activity for token android.os.BinderProxy@f4f37fa
D/EGL_emulation: eglMakeCurrent: 0xe6f85300: ver 2 0 (tinfo 0xe6f832c0)
D/EGL_emulation: eglMakeCurrent: 0xe6f85300: ver 2 0 (tinfo 0xe6f832c0)
D/EGL_emulation: eglMakeCurrent: 0xe6f85300: ver 2 0 (tinfo 0xe6f832c0)
I/chatty: uid=10086(com.example.quitter) RenderThread identical 1 line
D/EGL_emulation: eglMakeCurrent: 0xe6f85300: ver 2 0 (tinfo 0xe6f832c0)

Kotlin cannot access kotlin.jvm.functions.Function1 when calling kotlin function with java lambda

    chipNavigationBar.setOnItemSelectedListener(new ChipNavigationBar.OnItemSelectedListener() {
        @Override
        public void onItemSelected(int i) {

            if (i==R.id.menu_home) {

                LoadFrag(new HomeFrag());


            } else if (i == R.id.menu_fav) {


                LoadFrag(new FavFrag());


            }


        }
    });

while useing above event iam geting error as below during compiling

error: cannot access Function1
class file for kotlin.jvm.functions.Function1 not found

Set default selected item

I need to set one of the items as default selected when the view is shown. Right now all items are unselected. How can I make this?

Unresolved class error

when i use the dependencies, the "tools:context" field of every layout file shows error.
i am using it with java so used this dependencies:

implementation 'com.ismaeldivita.chipnavigation:chip-navigation-bar:1.3.2'
implementation 'org.jetbrains.kotlin:kotlin-stdlib:1.3.72'

the error shows " Unresolved class 'class_name' ".
please help me with this.

How to change Icon when selected?

I already do selector.xml for each icon and i program each icon for true and false android:state_checked. but it didn't work. did anyone have the solution?

SetOnItemSelectedListener() being called twice on clicking once.

So when I am clicking on one item once, the fragment matching with the clicked item id is being called twice. I don't think this is happening because of my code.

bottomBar is the chip-navigation-bar

binding.bottomBar.setOnItemSelectedListener { id -> when (id) { R.id.home1 -> { setFragment(HomeFragment1()) } R.id.home2 -> { setFragment(HomeFragment2()) } R.id.home3 -> { setFragment(HomeFragment3()) } } }

change the menutext and icon

Is there any way to change the text and icon of a menu item programmatically? For eg:if the user has a store. need to show the store image and store name on fourth item

Propper support to NavController

val navController = findNavController(R.id.nav_host_fragment)
binding.bottomNav.setupWithNavController(navController)
binding.bottomNav.setOnNavigationItemReselectedListener {/* NO-OP */ }

Java compatibility

Hello @ismaeldivita

Please make this library for java compatible, so we can use in java project also. It is very good looking working is there.

Thanks

problem with layout when clicked a item menu

my mainactivity.java code is
package com.asus.eins;

import androidx.annotation.MenuRes;
import androidx.appcompat.app.AppCompatActivity;
import androidx.viewpager.widget.ViewPager;

import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.MenuItem;
import android.widget.Toast;

import com.asus.eins.Fragment.Home;
import com.ismaeldivita.chipnavigation.ChipNavigationBar;

import java.util.ArrayList;
import java.util.List;

public class Dashboard extends AppCompatActivity {

ChipNavigationBar chipNavigationBar;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_dashboard);

    chipNavigationBar = findViewById(R.id.menu);

    chipNavigationBar.setOnItemSelectedListener(new ChipNavigationBar.OnItemSelectedListener() {

        @Override
        public void onItemSelected(int id) {
            switch (id) {
                case R.id.home:
                    chipNavigationBar.setMenuResource(R.layout.fragment_home);
                    break;
            }
        }
    });
}

}

and my mainactivity.xml is

<com.ismaeldivita.chipnavigation.ChipNavigationBar
    android:id="@+id/menu"
    android:layout_width="match_parent"
    android:layout_height="70dp"
    android:layout_alignParentBottom="true"
    android:background="#fff"
    android:elevation="16dp"
    android:gravity="center"
    android:padding="8dp"
    app:cnb_menuResource="@menu/bottom_menu" >

</com.ismaeldivita.chipnavigation.ChipNavigationBar>

i set on item selected with my fragment
but when i clicked a item menu my app is force close and show a error expecting menu, got relative layout

issue regarding the ".setOnItemSelectedListener"

"java.lang.NullPointerException: Attempt to invoke virtual method 'void com.ismaeldivita.chipnavigation.ChipNavigationBar.setOnItemSelectedListener(com.ismaeldivita.chipnavigation.ChipNavigationBar$OnItemSelectedListener)' on a null object reference"

langauge issues

please provide this in java so that this library can be used for java project. it is not working in java project .

AAPT: error: duplicate value for resource 'attr/pivotX' with config ''.

I am implementing the current last version 1.3.3 but get this error

 AAPT: error: duplicate value for resource 'attr/pivotX' with config ''.

It is basically because it uses the beta version of the constraint layout 2.0.0beta6 so when I reduce it to the stable version 1.1.3 some packages that are used by this library are not there yet! e.g. androidx.constraintlayout.helper

Can't use on my java project

Hi! I have tried to add it to my java project. I've added both dependencies, but I can't use the "app:cnb...." atributes on my XML files. How can it be solved?
Thanks

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.