Cleveroad/LoopBar

Extra icons automatically generated

Closed this issue · 5 comments

Hi,
I am not sure if it is a bug or that I have done something wrong, but I only configured 2 items in my adapter, using List, with infinite scrolling left at default 'on'. As can be seen from the attached, the ibrary generates additional entries to fill up the strip.

Also, as indicated in the picture, there is a bit of shadow on both edges of the strip, can that be removed?
This was rendered on emulator Nexus X5 api23

untitled

regards,

Iojjj commented

Hi @usergoodvery,

have you tried to set enls_infiniteScrolling to false in XML or via Java LoopBarView.setIsInfinite? By default this widget is in the infinite scrolling mode.

Could you share your XML layout so we can check shadows on edges?

Hi,
I set scrolling to false and that stopped the generation of the extraneous icons. I think you may want to revisit that behviour; it should not create extra icons regardless.

I also noticed with the property enls_overlaySize the whole strip is raised, not just the selection (in orange). I think that shadow is just the normal strip height. I exaggerated the size to 10dp and the overhang is clearly visible.

I included the layout, it is not doing much as you can see...

<android.support.v4.widget.DrawerLayout 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:id="@+id/drawer_layout_gdata"
android:layout_width="match_parent"
android:layout_height="match_parent">

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:fitsSystemWindows="true">

    <include android:id="@+id/toolbar" layout="@layout/toolbar" />

    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
                  android:id="@+id/drawer_layout_ll"
                  android:layout_width="match_parent"
                  android:layout_height="match_parent"
                  android:layout_below="@+id/toolbar"
                  android:orientation="vertical">
    <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:id="@+id/root"
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    tools:context="com.cleveroad.sample.fragments.AbstractLoopBarFragment">

                    <android.support.v4.view.ViewPager xmlns:android="http://schemas.android.com/apk/res/android"
                                           xmlns:tools="http://schemas.android.com/tools"
                                           android:id="@+id/pager"
                                           android:layout_width="match_parent"
                                           android:layout_height="match_parent"
                                           android:layout_below="@+id/sliding_tabs"
                                           android:textSize="20dp"
                                           android:textStyle="bold"
                                           tools:context=".ActivityUser" />


        <View
            android:id="@+id/placeHolder"
            android:layout_width="match_parent"
            android:layout_height="0dp"
            android:layout_alignParentBottom="true" />

        <com.cleveroad.loopbar.widget.LoopBarView
            android:id="@+id/loopbarView"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentBottom="true"
            android:background="@color/gray12"
            app:enls_infiniteScrolling="false"
            app:enls_orientation="horizontal"
            app:enls_overlaySize="5dp"
            app:enls_placeholderId="@id/placeHolder"
            app:enls_selectionBackground="?attr/colorPrimaryDark"
            app:enls_selectionGravity="start"
            app:enls_selectionInAnimation="@animator/enls_scale_restore"
            app:enls_selectionMargin="15dp"
            app:enls_selectionOutAnimation="@animator/enls_scale_small" />

    </RelativeLayout>
    </LinearLayout>

    <LinearLayout
        android:id="@+id/overlay_gray"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:animateLayoutChanges="true"
        android:background="#BB000000"
        android:backgroundTint="@color/white"
        android:orientation="horizontal"
        android:visibility="gone">

    </LinearLayout>

</RelativeLayout>

<!-- The navigation drawer -->
<LinearLayout
    android:id="@+id/drawerll"
    android:layout_width="230dp"
    android:layout_height="match_parent"
    android:layout_gravity="start"
    android:fitsSystemWindows="true"
    android:orientation="vertical">

    <LinearLayout
        android:id="@+id/drawer"
        android:layout_width="230dp"
        android:layout_height="wrap_content"
        android:layout_gravity="start"
        android:background="@color/ufaccent"
        android:gravity="left"
        android:orientation="vertical">

        <RelativeLayout
            android:id="@+id/containerrl"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent">

            <LinearLayout
                android:id="@+id/container"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="start"
                android:background="@color/ufaccent"
                android:gravity="center_vertical"
                android:orientation="vertical">

                <com.unfacd.android.ui.components.ForegroundImageView
                    android:id="@+id/profile_picture"
                    android:layout_width="230dp"
                    android:layout_height="200dp"
                    android:layout_gravity="center"
                    android:scaleType="centerCrop"
                    android:visibility="visible" />
            </LinearLayout>

            <LinearLayout
                android:id="@+id/drawer2"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:orientation="vertical"
                android:paddingTop="30dp">
                <!--android:background="@color/bpTransparent_black"-->
                <LinearLayout
                    android:id="@+id/drawer_background"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"

                    android:orientation="vertical"
                    android:paddingBottom="5dp"
                    android:paddingTop="5dp">

                    <TextView
                        android:id="@+id/profileName"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:gravity="center"
                        android:paddingLeft="15dp"
                        android:paddingRight="15dp"
                        android:text=""
                        android:textColor="@color/white"
                        android:textSize="10sp"
                        android:textStyle="bold" />

                    <TextView
                        android:id="@+id/profileStatus"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_marginTop="5dp"
                        android:gravity="center"
                        android:paddingLeft="15dp"
                        android:paddingRight="15dp"
                        android:text=""
                        android:textColor="@color/white"
                        android:textSize="10sp"
                        android:textStyle="bold" />
                </LinearLayout>
            </LinearLayout>
        </RelativeLayout>
    </LinearLayout>

    <ListView
        android:id="@+id/left_drawer"
        android:layout_width="230dp"
        android:layout_height="match_parent"
        android:layout_gravity="start"
        android:background="@color/menuItemBackground"
        android:choiceMode="singleChoice"
        android:divider="@color/menuDivider"
        android:dividerHeight="1px"
        android:scrollbars="none" />
</LinearLayout>

</android.support.v4.widget.DrawerLayout>

Iojjj commented

This widget designed for multiple items (5 or more). By default infinite scroll is enabled so we display a lot of items. You will always see a lot of groups containing N-1 items because one of item is always selected. In your case you see groups with a single item. That's why you should avoid displaying so small number of items.

We'll check an issue with shadows after holidays. We also check what we can do with auto-detecting if there are few items in adapter. Maybe we should turn off infinite scroll in such cases.

Hi @usergoodvery,
In version 1.1.1 we removed shadows you asked for.
Also there is a new way for scroll mode settings. We added an "auto" mode to existed "infinite" and "finite" modes. It will check if groups fits the screen and in positive case it will not generate extra items. For scroll mode selection use attribute "enls_scrollMode" in xml or LoopBarView.setScrollMode in java. Old way (via enls_infiniteScrolling to false in XML and LoopBarView.setIsInfinite) is deprecated, but still works only without an ability to set "auto" mode.

good stuff thank you