Code Monkey home page Code Monkey logo

space-navigation-view's People

Contributors

akiraspeirs avatar ankitpopli1891 avatar armcha avatar firezenk avatar mseroczynski avatar rvndbalaji avatar subhrajyotisen 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

space-navigation-view's Issues

Provide a way for the SpaceOnClickListener to veto switching to the clicked item

Under certain circumstances I want to do something when one of the items is clicked, but prevent that item from being selected as the current item. Could be implemented as the onItemClick method instead of being void returning a boolean, indicating whether it wants to allow the view to switch to the clicked item or not.

I tried to work around that by setting the currently selected item back to the previous one from the click listener itself, but that doesn't work as the actual switch to the clicked item only occurs after the listener has been called.

Change Selected Item Color Not Updating

This is probably my error so please forgive me. I notice that spaceNavigationView.setActiveSpaceItemColor(ContextCompat.getColor(this, R.color.yourColor)); does not actually update the currently selected item color. That means the following code does not work properly because the color that is set will be applied to the next selected icon. Example, Item 1 selected and Item 1's icon is Red. When Item 2 is selected, Item 2's icon is Red. When Item 3 is selected, Item 3's icon is Blue.

    spaceNavigationView.setSpaceOnClickListener(new SpaceOnClickListener() {
        @Override
        public void onCentreButtonClick() {
        }

        @Override
        public void onItemClick(int itemIndex, String itemName) {
            Log.d("Click", Integer.toString(itemIndex));
            switch (itemIndex)
            {
                case 0:
                    spaceNavigationView.setActiveSpaceItemColor(ContextCompat.getColor(getApplicationContext(), R.color.RED));
                    break;
                case 1:
                    spaceNavigationView.setActiveSpaceItemColor(ContextCompat.getColor(getApplicationContext(), R.color.BLUE));
                    break;
                case 2:
                    spaceNavigationView.setActiveSpaceItemColor(ContextCompat.getColor(getApplicationContext(), R.color.YELLOW));
                    break;
                case 3:
                    spaceNavigationView.setActiveSpaceItemColor(ContextCompat.getColor(getApplicationContext(), R.color.GREEN));
                    break;
                default: break;
            }
        }

        @Override
        public void onItemReselected(int itemIndex, String itemName) {
        }
    });

Is there a proper way to set the icon color so it updates the currently selected item color? Something like changeSpaceBackgroundColor(). Thank you for taking a look!

Enable changing the SpaceItems shown in the SpaceNavigationView

There is currently no way to change the items or even the text of the items currently shown in the navigation bar. This would be massively helpful, as I need to change the text of one of the items when the user performs a certain action, without completely rebuilding the layout.

CentreButtonIconColor (#17) breaks custom icon support

I was using a custom icon for the center button icon. The latest update applies a mask to the icon which is undesirable for when you want to use a custom icon. The new masking feature takes away the ability to use anything other than a solid color icon.

I will be reverting back to 1.3.0. Hopefully, there will be an option to have both in a future update. Thank you!

Centre Button Selectable Conflicts with Custom Icon

@Kogoro
Using spaceNavigationView.setCentreButtonIconColorFilterEnabled(false);
does not work when spaceNavigationView.setCentreButtonSelectable(true); is also used.
You mentioned that you use a custom icon, how are you able to get your custom icon to show?

method names?

there is a method named hideBudges? shouldn't this be hideBadges? also Centre -> Center on method names?

Manipulating Selection

It would be great to be able to set the selection index manually. Also the centrebutton should be selectable.

Reason:
In my application, the centre button is the representation for the main fragment. But the selection is always on the first item at the startup. So it would be great if I could manipulate the selection.
If you don't have time. but accept pull requests, I could give it a try though it should be easy to implement.

TextView layout_gravity="center"

if one changed the icon size, via app:space_item_icon_size="24dp" the Text will be not be centered veritcally with the icon. i guess you might need to center the TextView layout gravity instead of aligning it top.

Recyclerview scroll behaviour

Nice work,I so love your library. Please how can I add a FAB behaviour to the space navigation bar? I mean I want the space navigation view to autohide when recyclerview is scrolled up and down. Thanks and thumbs up for an awesome library.

CenterButtonColor

I want to add gradient color on CentreButtonColor from drawable file from java and xml both but its not working.

Rendering Error in Preview

Rendering error caused by Line 213-221 in SpaceNavigationView.java
untitled20160901113656

Fix by removing or overriding for preview. Thanks for making the Space Navigation View. It is AMAZING! 🎆

Space Navigation View won't show!

I use you library with support library version 24.
when I add it to my xml, I can see the area that is belong to space navigation view, but it seems it is empty! I add spaceItems to it programmatically, but nothing happens!

Control Centre FloatingActionButton

More functionalities like disable FAB or hide, or something like this.

Also something like getFab() or getFabView() to control the View like RotationAnimation.

Support Drawable icons

spaceNavigationView.addSpaceItem(new SpaceItem("HOME", R.drawable.yourDrawable)); should support Drawables as well

Unable to change center button icon

Attempting to change the center button icon results in a null exception error. The error says that the FAB has not been initiated yet. However, Space Navigation View has been initiated. Might this be a bug?

SpaceNavigationView spaceNavigationView = (SpaceNavigationView) findViewById(R.id.space);
spaceNavigationView.initWithSaveInstanceState(savedInstanceState);
spaceNavigationView.changeCenterButtonIcon(R.drawable.company_icon);
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.blankicon/com.blankicon.MainActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.support.design.widget.FloatingActionButton.setImageResource(int)' on a null object reference
                                                                 at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2416)
                                                                 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.NullPointerException: Attempt to invoke virtual method 'void android.support.design.widget.FloatingActionButton.setImageResource(int)' on a null object reference

Thank you for taking a look!

Showing a badge throws IndexOutOfBoundsException if called from main Activity lifecycle methods

Hey @armcha, really liking the library!
I set up my SpaceNavigationView in the onCreate of my Activity with the same setup shown in the readme and have added bottomNav.onSaveInstanceState(outState); in my onSaveInstanceState.
Everything looks and works great in the launched activity, SpaceOnClickListener events are returning the correct name and index for my items. But if I try to call

spaceNavigationView.showBadgeAtIndex(0,5, ContextCompat.getColor(this, R.color.cyan));

in any of the main lifecycle methods in my Activity (bottom of onCreate, onResume, onPostResume, etc.) the SpaceNavigationView throws an IndexOutOfBoundsException:
Caused by: java.lang.IndexOutOfBoundsException: Invalid index 0, size is 0 at java.util.ArrayList.throwIndexOutOfBoundsException(ArrayList.java:255) at java.util.ArrayList.get(ArrayList.java:308) at com.luseen.spacenavigation.SpaceNavigationView.showBadgeAtIndex(SpaceNavigationView.java:822) at com.proto.tangible.tagalong.ExploreActivity$override.onResume(ExploreActivity.java:193) at com.proto.tangible.tagalong.ExploreActivity$override.access$dispatch(ExploreActivity.java) at com.proto.tangible.tagalong.ExploreActivity.onResume(ExploreActivity.java:0) at android.app.Instrumentation.callActivityOnResume(Instrumentation.java:1326) at android.app.Activity.performResume(Activity.java:6323) at android.app.ActivityThread.performResumeActivity(ActivityThread.java:3311) at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:3359)  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2549)  at android.app.ActivityThread.handleRelaunchActivity(ActivityThread.java:4398)  at android.app.ActivityThread.access$1000(ActivityThread.java:150)  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1400)  at android.os.Handler.dispatchMessage(Handler.java:102)  at android.os.Looper.loop(Looper.java:168)  at android.app.ActivityThread.main(ActivityThread.java:5845)  at java.lang.reflect.Method.invoke(Native Method)  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:797)  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:687) 

However, calling the same line some time after the Activity loads (in response to a manual click event or async task with Thread.sleep(400) works just fine for me!

Looking at the library source it seems like the SpaceNavigationView needs to have been laid out before its possible to show badges for your SpaceItems. In most situations the badge quantity to display is calculated almost instantly, so waiting for the draw is a little cumbersome

Elevation and Shadow support

Per the material design spec this component should have a default elevation of 8dp and cast a shadow upwards on to the content above it - it doesn't seem to do that currently regardless of elevation being set in the layout or in code.

No reason NullPointer: Your space item count must be greater than 1 , your current items count isa : 0

Currently i am using this:

SpaceNavigationView spaceNavigationView = (SpaceNavigationView) findViewById(R.id.space);
spaceNavigationView.initWithSaveInstanceState(savedInstanceState);spaceNavigationView.setSpaceBackgroundColor(ContextCompat.getColor(this, R.color.colorPrimaryDark));
spaceNavigationView.addSpaceItem(new SpaceItem("HOME", R.drawable.ic_home_white_48dp));
spaceNavigationView.addSpaceItem(new SpaceItem("ANTEPRIMA", R.drawable.ic_web_white_48dp));

But when i call

spaceNavigationView.setSpaceOnClickListener(new SpaceOnClickListener() {
@OverRide
public void onCentreButtonClick() {
startActivity(new Intent(MainActivity.this, FormActivity.class));
}
...

I get the error message even if i added two working items:

java.lang.NullPointerException: Your space item count must be greater than 1 , your current items count isa : 0

Vector icons with colors and custom bar height

Hi, I try to put a colored icon in the bar, but I only see a white silhouette, its posible to show the colored version? And how can i change the height of the icons bar? Thanks a lot!

Exception in XML layout preview when using the space navigation

When I use the space navigation in a layout file the preview window will throw an Exception:

java.lang.NullPointerException: Your space item count must be greater than 1 , your current items count is : 0

This makes the preview basically unsuable. Is there a way you could just show dummy items when in the preview, or can you provide items directly in the xml?

changeCurrentItem(0)

When I set the

spaceNavigationView.changeCurrentItem(0);

can't not trigger the onItemClick event.

Make the centerIcon bigger

Hello,

is it possible to make the center icon bigger? I want to fill the whole button with an icon (e.g. a circled profile image)

Thx :-)

Remove space item

Currently you can add space items, but you cannot remove them?
I am working on an activity which has two fragments, each fragment would have different nav icons and one has more icons than the other. I can add icons when moving to the second frag, but cannot remove nav icons when moving back to the first fragment.

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.