For Stack overflow question
package com.github.binpower93.tubes.Cards; | |
import android.content.Context; | |
import android.support.v7.widget.CardView; | |
import android.support.v7.widget.LinearLayoutManager; | |
import android.support.v7.widget.RecyclerView; | |
import android.view.LayoutInflater; | |
import android.widget.Button; | |
import android.widget.LinearLayout; | |
import com.github.binpower93.tubes.Adapters.NewLineServedAdapter; | |
import com.github.binpower93.tubes.R; | |
import com.github.binpower93.tubes.Utils.LineDesign; | |
import java.util.ArrayList; | |
import java.util.List; | |
/** | |
* Created by ben on 10/09/2014. | |
*/ | |
public class LinesServedCard { | |
private RecyclerView.LayoutManager mLayoutManager; | |
private Context mContext; | |
private CardView mCardView; | |
private RecyclerView mRecyclerView; | |
private Button mLiveTrainsButton; | |
private NewLineServedAdapter mAdapter; | |
private List<LineDesign> lineDesigns; | |
public LinesServedCard(Context context, LinearLayout parent) { | |
LayoutInflater inflater = (LayoutInflater) context.getSystemService( Context.LAYOUT_INFLATER_SERVICE ); | |
mCardView = (CardView) inflater.inflate(R.layout.card_lines_served, null); | |
parent.addView(mCardView); | |
mRecyclerView = (RecyclerView) mCardView.findViewById(R.id.lines_served_container); | |
// use this setting to improve performance if you know that changes | |
// in content do not change the layout size of the RecyclerView | |
mRecyclerView.setHasFixedSize(true); | |
// use a linear layout manager | |
mLayoutManager = new LinearLayoutManager(context); | |
mRecyclerView.setLayoutManager(mLayoutManager); | |
// specify an adapter (see also next example) | |
mAdapter = new NewLineServedAdapter(new ArrayList<LineDesign>()); | |
mRecyclerView.setAdapter(mAdapter); | |
//setVisible(false); | |
//mContext = context; | |
} | |
/*public void setVisible(boolean visible) { | |
//mCardView.setVisibility(visible ? View.VISIBLE : View.VISIBLE); | |
} | |
public void setStationDetails(StationDetails stationDetails) { | |
if(stationDetails == null) { | |
setVisible(false); | |
} else { | |
List<LineDesign> lineDesigns = LineUtils.getUsefulInfo(mContext, stationDetails, false); | |
mAdapter.addAll(lineDesigns); | |
} | |
}*/ | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment