4

i am using this AndroidSlidingUpPanel .

My main content is Map and second one which slide up panel is Recyclerview . But Issue is it not coming on panel size correctly.

On Collapsed State : its coming correctly but as soon as i drag up and expanded State it shows the orange color bar like thing at end . Orange color is due to the background set in linear Layout which is the host of RcycleView . If we remove the background then also problem stays which THE BAR LIKE THING AT END OF RECYCLER VIEW LIST .

I want : Recycler view to be show as same height as Panel . No linear layout shown at end of it .

I think i did something wrong in placing views in XML . But i didn't able to understand what .

Collapsed PanelState enter image description here

EXPANDED STATE

enter image description here

main.xml

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

<com.sothree.slidinguppanel.SlidingUpPanelLayout
    xmlns:sothree="http://schemas.android.com/apk/res-auto"
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/sliding_layout"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:gravity="bottom"
    sothree:umanoShadowHeight="0dp"
    sothree:umanoDragView="@+id/dragView"
    sothree:umanoFadeColor="@android:color/transparent">


        <fragment
            android:id="@+id/map"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            class="com.google.android.gms.maps.SupportMapFragment"/>

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height= "match_parent"
        android:background="#d35400"
        android:orientation="vertical"
        android:id="@+id/dragView">

        <android.support.v7.widget.RecyclerView
        android:id="@+id/path_recycler_view"
        android:layout_width="match_parent"
            android:orientation="vertical"
        android:layout_height="match_parent"
        android:clickable="true"
        android:focusable="false"
        xmlns:android="http://schemas.android.com/apk/res/android" />
        </LinearLayout>
</com.sothree.slidinguppanel.SlidingUpPanelLayout>
    </RelativeLayout>

MainActivity.java

protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_path_google_map);
        final SupportMapFragment fm = (SupportMapFragment) getSupportFragmentManager()
                .findFragmentById(R.id.map);
        googleMap = fm.getMap();
        mLayout = (SlidingUpPanelLayout) findViewById(R.id.sliding_layout);
        FrameLayout fl = (FrameLayout) findViewById(R.id.list_fragment_container);
        recyclerView = (RecyclerView)findViewById(R.id.path_recycler_view);
         mMapCover = (View)findViewById(R.id.curtain_view);


ArrayList<MapHolders> holders = SingleTon.getInstance().getMapHolders();
        holders = SingleTon.getInstance().getMapHolders();
        if (holders != null && holders.size() > 0) {
            String url = getMapsApiDirectionsUrl();
            ReadTask downloadTask = new ReadTask();
            downloadTask.execute(url);

            googleMap.moveCamera(CameraUpdateFactory.newLatLng(holders.get(0).latLng));
            googleMap.animateCamera(CameraUpdateFactory.zoomTo(10));

            googleMap.setMyLocationEnabled(true);

               /*SlidingPanelUpLayout*/

            mLayout.setPanelState(SlidingUpPanelLayout.PanelState.HIDDEN);



            addMarkers();

        }


        mLayout.setPanelSlideListener(new SlidingUpPanelLayout.PanelSlideListener() {
            @Override
            public void onPanelSlide(View panel, final float slideOffset) {
                Log.i(TAG, "onPanelSlide, offset " + slideOffset);
                googleMap.getUiSettings().setAllGesturesEnabled(true);              

            }

            @Override
            public void onPanelExpanded(View panel) {
                Log.i(TAG, "onPanelExpanded");
                googleMap.getUiSettings().setAllGesturesEnabled(false);

            }

            @Override
            public void onPanelCollapsed(View panel) {
                slideFrag = true;
                Log.i(TAG, "onPanelCollapsed");
                googleMap.getUiSettings().setAllGesturesEnabled(false);

            }

            @Override
            public void onPanelAnchored(View panel) {
                Log.i(TAG, "onPanelAnchored");
            }

            @Override
            public void onPanelHidden(View panel) {
                slideFrag = false;
                Log.i(TAG, "onPanelHidden");
            }
        });

        mMapCover.setOnTouchListener(new View.OnTouchListener() {
            @Override
            public boolean onTouch(View v, MotionEvent event) {
                if (mLayout.getPanelState() == SlidingUpPanelLayout.PanelState.COLLAPSED) {
                    mLayout.setPanelState(SlidingUpPanelLayout.PanelState.HIDDEN);
                    return true;
                }

                return false;
            }
        });

    }

    private void addMarkers() {



        googleMap.setOnMarkerClickListener(new GoogleMap.OnMarkerClickListener() {
            @Override
            public boolean onMarkerClick(Marker marker) {

                mLayout.setPanelHeight(400);


                    if(mLayout!=null){
                        Log.i("marker", "collapsed");
                        mLayout.setPanelState(SlidingUpPanelLayout.PanelState.COLLAPSED);
                        animateLatLngZoom(points, 0, -10, 10);

                    }else{
                        Log.i("marker","Hidden");
                        mLayout.setPanelState(SlidingUpPanelLayout.PanelState.HIDDEN);
                    }
                }


                return true;
            }
        });




}

Please help me finding an issue .

young_08
  • 1,196
  • 2
  • 13
  • 35
  • One advice, for sake of performance remove `RelativeLayout` or in case you are using Toolbar and didn't show it for simplicity use `FrameLayout` instead. I still couldn't figure out where is the issue but will have a look at that. This is just for now :) – Hesam Dec 12 '15 at 01:44
  • Just for sake of experiment, can you set the height of sliding to something (lets say 600dp). In this way if you still see orange area then it shows something with your code is wrong that adds another row to recycler view. – Hesam Dec 14 '15 at 18:07
  • @Hesam Yes , it ll still shows the orange area . In this also , if see the code in mainactivity.java , On marker click i have set the panel.height=400dp . And its showing . This same is happening on any height set . – young_08 Dec 15 '15 at 06:07

0 Answers0