Created
October 19, 2014 00:54
-
-
Save binpower93/48f25f2fd3fc9983dec3 to your computer and use it in GitHub Desktop.
For Stack overflow question
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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