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
public class SignInActivity extends AppCompatActivity { | |
SignInButton button; | |
FirebaseAuth mAuth; | |
private final static int RC_SIGN_IN = 2; | |
GoogleApiClient mGoogleApiClient; | |
FirebaseAuth.AuthStateListener mAuthListener; | |
@Override | |
protected void onStart() { | |
super.onStart(); |
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
@Override | |
public int getItemCount() { | |
// Size of list is defined as listItems size | |
return listItems.size(); | |
} |
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
public class MyAdapter extends RecyclerView.Adapter<MyAdapter.ViewHolder> { | |
// Context object used to inflate list_item layout | |
private List<ListItem> listItems; | |
private Context context; | |
// Generated constructor from members | |
public MyAdapter(List<ListItem> listItems, Context context) { | |
this.listItems = listItems; | |
this.context = context; | |
} |
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
public class MainActivity extends AppCompatActivity { | |
private RecyclerView recyclerView; | |
private RecyclerView.Adapter adapter; | |
private List<ListItem> listItems; | |
@Override | |
protected void onCreate(Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); |
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
@Override | |
public void onBindViewHolder(MyAdapter.ViewHolder holder, int position) { | |
ListItem listItem = listItems.get(position); | |
holder.textViewHead.setText(listItem.getHead()); | |
holder.textViewDesc.setText(listItem.getDesc()); | |
} |
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
@Override | |
public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { | |
View v = LayoutInflater.from(parent.getContext()) | |
.inflate(R.layout.list_item, parent, false); | |
return new ViewHolder(v); | |
} |
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
public class MyAdapter extends RecyclerView.Adapter<MyAdapter.ViewHolder> { | |
private List<ListItem> listItems; | |
private Context context; | |
public MyAdapter(List<ListItem> listItems, Context context) { | |
this.listItems = listItems; | |
this.context = context; | |
} |
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
<RelativeLayout | |
android:layout_width="match_parent" | |
android:layout_height="wrap_content"> | |
<android.support.v7.widget.CardView | |
android:layout_marginVertical="16dp" | |
android:layout_marginHorizontal="16dp" | |
android:layout_width="match_parent" | |
android:layout_height="wrap_content"> |
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
<android.support.v7.widget.RecyclerView | |
android:id="@+id/recyclerView" | |
android:layout_width="match_parent" | |
android:layout_height="wrap_content"> | |
</android.support.v7.widget.RecyclerView> |
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
public class ViewHolder extends RecyclerView.ViewHolder{ | |
public TextView textViewHead; | |
public TextView textViewDesc; | |
public ViewHolder(View itemView) { | |
super(itemView); | |
textViewHead = (TextView) itemView.findViewById(R.id.textViewHead); | |
textViewDesc = (TextView) itemView.findViewById(R.id.textViewDesc); |
NewerOlder