Skip to content
This repository has been archived by the owner on Jul 22, 2019. It is now read-only.

SwipeStack is not Visible #64

Open
SimonPeter1909 opened this issue Jun 19, 2018 · 10 comments
Open

SwipeStack is not Visible #64

SimonPeter1909 opened this issue Jun 19, 2018 · 10 comments

Comments

@SimonPeter1909
Copy link

I would like to implement Swipe Stack View in my layout I have done all the things perfect yet I cant the SwipeStackView is not visible in my layout... Should the StackVIew be single in the Activity?

Stack View inside layout and i have set android:clipChildren="false" in parent View.

<link.fls.swipestack.SwipeStack
        android:layout_gravity="center"
        android:id="@+id/swipe_deck"
        app:disable_hw_acceleration="false"
        android:layout_width="match_parent"
        android:layout_height="150dp"
        app:stack_rotation="10"
        app:stack_size="3" />

This is how i have installed in my java file

swipeDeck = findViewById(R.id.swipe_deck);
 swipeDeck.setAdapter(new SwipeLayoutAdapter(todayMeetingModelList));
        swipeDeck.setListener(new SwipeStack.SwipeStackListener() {
            @Override
            public void onViewSwipedToLeft(int position) {

            }

            @Override
            public void onViewSwipedToRight(int position) {

            }

            @Override
            public void onStackEmpty() {
                swipeDeck.resetStack();
            }
        });

and this is how i set the adapter

public class SwipeLayoutAdapter extends BaseAdapter{
      private List<TodayMeetingModel> todayMeetingModelList;

      public SwipeLayoutAdapter(List<TodayMeetingModel> todayMeetingModelList) {
          this.todayMeetingModelList = todayMeetingModelList;
      }


      @Override
      public int getCount() {
          return todayMeetingModelList.size();
      }

      @Override
      public Object getItem(int position) {
          return todayMeetingModelList.get(position);
      }

      @Override
      public long getItemId(int position) {
          return position;
      }

      @Override
      public View getView(int position, View convertView, ViewGroup parent) {

          if (convertView==null) convertView = getLayoutInflater().inflate(R.layout.card_view_today_club_meeting,parent,false);

          TodayMeetingModel todayMeetingModel = todayMeetingModelList.get(position);

          TextView clubNameTV = convertView.findViewById(R.id.clubMeetingNameTV);
          clubNameTV.setText(todayMeetingModel.getClub_name());

          TextView timeTV = convertView.findViewById(R.id.timeTV);
          timeTV.setText(todayMeetingModel.getClub_meeting_time());

          TextView dateTV = convertView.findViewById(R.id.dateTV);
          dateTV.setText(todayMeetingModel.getDay_name());

          TextView addressTV = convertView.findViewById(R.id.clubAddressTV);
          addressTV.setText(todayMeetingModel.getClub_address());

          return convertView;

      }
  }

My problem is the SwipeStackView is not Visible on the screen...

@joshvarun
Copy link

Can you post your activity XML?

@SimonPeter1909
Copy link
Author

SimonPeter1909 commented Jun 19, 2018

@joshvarun yeah sure...

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:swipedeck="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    app:layout_behavior="@string/appbar_scrolling_view_behavior"
    tools:context=".Activities.HomeActivity"
    tools:showIn="@layout/app_bar_home"
    android:clipChildren="false">

    <TextView
        android:id="@+id/todayMeetingTV"
        android:layout_width="match_parent"
        android:layout_height="50dp"
        android:gravity="start|center_vertical"
        android:padding="10dp"
        android:text="Today's Club Meeting"
        android:textColor="@color/cardview_dark_background"
        android:textSize="18sp"
        android:textStyle="bold" />


    <link.fls.swipestack.SwipeStack
        android:layout_gravity="center"
        android:id="@+id/swipe_deck"
        app:disable_hw_acceleration="false"
        android:layout_width="match_parent"
        android:layout_height="150dp"
        app:stack_rotation="10"
        app:stack_size="3" />

    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content">

        <android.support.v7.widget.CardView
            android:id="@+id/flipperCV"
            android:layout_width="match_parent"
            android:layout_height="150dp"
            android:layout_alignParentTop="true"
            android:layout_margin="5dp"
            app:cardElevation="5dp"
            app:cardUseCompatPadding="true">

            <RelativeLayout
                android:layout_width="match_parent"
                android:layout_height="match_parent">

                <technolifestyle.com.imageslider.FlipperLayout
                    android:id="@+id/flipper_layout"
                    android:layout_width="match_parent"
                    android:layout_height="match_parent" />


            </RelativeLayout>


        </android.support.v7.widget.CardView>

        <RelativeLayout
            android:id="@+id/birthdayListRL"
            android:layout_width="match_parent"
            android:layout_height="250dp"
            android:layout_below="@id/flipperCV">

            <TextView
                android:id="@+id/birthdayTV"
                android:layout_width="match_parent"
                android:layout_height="50dp"
                android:gravity="start|center_vertical"
                android:padding="10dp"
                android:text="Upcoming Birth Days &amp; Wedding Days"
                android:textColor="@color/cardview_dark_background"
                android:textSize="18sp"
                android:textStyle="bold" />

            <android.support.v7.widget.RecyclerView
                android:id="@+id/birthdayListRV"
                android:layout_width="match_parent"
                android:layout_height="250dp"
                android:layout_below="@id/birthdayTV">

            </android.support.v7.widget.RecyclerView>

        </RelativeLayout>

    </RelativeLayout>

</LinearLayout>

@freeweed
Copy link

freeweed commented Jun 19, 2018

I have this problem too, in my case some row is visible but some row is not.
Have any Idea?

@SimonPeter1909
Copy link
Author

@freeweed try adjusting the height... btw still my cards are invisible... :( ... someone, please help me...

@SimonPeter1909
Copy link
Author

@freeweed I solved my problem... I have used com.github.wenchaojiang:AndroidSwipeableCardStack:0.1.5 library... and it's working awesome... I think you can't add images to the card... try this...

@freeweed
Copy link

@SimonPeter1909 thx. I solved mine by remove invisible data. lol

@nanoakhi
Copy link

Hi Simon..How you resolved the issues
Same problem i am facing data loaded showing me in console but invisible on card.What should i do using same code as urs

@SimonPeter1909
Copy link
Author

@nanoakhi, I have used com.github.wenchaojiang:AndroidSwipeableCardStack:0.1.5 library... It works fine but it doesn't supports the images... Give it a try...

@nanoakhi
Copy link

@simon: The lib has same problem .Still data invisible while loading from mysql database .Do u have running code in vh Multiple data is loading to stack .

@nanoakhi
Copy link

SimonPeter1909 : While using the same code as we were using its showing some miss behavior such as when i minimize the activity and again open it its showing the results...Fail to track why this happening too.Do u have any idea.

My main activity code is:

public void JSON_PARSE_DATA_AFTER_WEBCALL(JSONArray array) {

    for (int i = 0; i < array.length(); i++) {

        GetDataAdapter GetDataAdapter2 = new GetDataAdapter();
        JSONObject json = null;
        try {
            json = array.getJSONObject(i);

            GetDataAdapter2.setPROFILE_IMAGE(json.getString(JSON_PROFILE_IMAGE));
          //  GetDataAdapter2.setCOMPANY(json.getString(JSON_COMPANY));

           // GetDataAdapter2.setDSG(json.getString(JSON_DSG));
            GetDataAdapter2.setFIRSTNAME(json.getString(JSON_FIRSTNAME));

          //  GetDataAdapter2.setLASTNAME(json.getString(JSON_LASTNAME));
          //  GetDataAdapter2.setCARDMOBILE(json.getString(JSON_CARDMOBILE));
           // GetDataAdapter2.setCOVER(json.getString(JSON_COVER));
            GetDataAdapter2.setMOBILE("MOBILE");
        } catch (JSONException e) {

            e.printStackTrace();
        }
        GetDataAdapter1.add(GetDataAdapter2);
    }

       cardsAdapter = new CardsAdapter(GetDataAdapter1,tinderdesk.this);

        cardStack.setAdapter(cardsAdapter);



}

AND

ADAPTER CODING IS
;
public class CardsAdapter extends BaseAdapter {

private Activity activity;

public List<GetDataAdapter> getDataAdapter;

CardsAdapter(List<GetDataAdapter> getDataAdapter,Activity activity) {
    super();
    this.getDataAdapter = getDataAdapter;
    this.activity = activity;
}


@Override
public int getCount() {
    return getDataAdapter.size();
}

@Override
public Object getItem(int position) {
    return getDataAdapter.get(position);
}

@Override
public long getItemId(int position) {
    return position;
}

@Override
public View getView(final int position, View convertView, ViewGroup parent) {

    final int pos = position;
    final GetDataAdapter getDataAdapter1 = getDataAdapter.get(pos);
    ViewHolder holder;
    LayoutInflater inflater = (LayoutInflater) activity.getSystemService(Activity.LAYOUT_INFLATER_SERVICE);
    // If holder not exist then locate all view from UI file.
    if (convertView == null) {
        // inflate UI from XML file
        assert inflater != null;
        convertView = inflater.inflate(R.layout.tinder_card_layout, parent, false);
        // get all UI view
        holder = new ViewHolder(convertView);
        // set tag for holder
        convertView.setTag(holder);
    } else {
        // if holder created, get tag from view
        holder = (ViewHolder) convertView.getTag();
        holder.name.setText(getDataAdapter1.getFIRSTNAME());
        holder.location.setText(getDataAdapter1.getMOBILE());
    }

    //setting data to views


 /*   Picasso.with(activity)
            .load(getDataAdapter1.getPROFILE_IMAGE()).fit().centerCrop()
            .into(holder.avatar);*/



    return convertView;
}

class ViewHolder{
    private ImageView avatar;
    private TextView name;
    private TextView location;

   ViewHolder(View view) {
        avatar = (ImageView)view.findViewById(R.id.header_cover_image);
        name = (TextView)view.findViewById(R.id.profilename);
        location = (TextView)view.findViewById(R.id.skill);
    }
}

}

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants