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 Chapter { | |
public int id; | |
public String chapterName; | |
public String imageUrl; | |
} |
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 Subject { | |
public int id; | |
public String subjectName; | |
public ArrayList<Chapter> chapters; | |
} |
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
private ArrayList<Subject> prepareData() { | |
ArrayList<Subject> subjects = new ArrayList<Subject>(); | |
Subject physics = new Subject(); | |
physics.id = 1; | |
physics.subjectName = "Physics"; | |
physics.chapters = new ArrayList<Chapter>(); | |
Chapter chapter1 = new Chapter(); | |
chapter1.id = 1; |
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
<?xml version="1.0" encoding="utf-8"?> | |
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | |
android:orientation="vertical" android:layout_width="wrap_content" | |
android:layout_height="wrap_content"> | |
<android.support.v7.widget.CardView | |
xmlns:card_view="http://schemas.android.com/apk/res-auto" | |
android:id="@+id/card_view" | |
android:layout_margin="5dp" | |
android:layout_gravity="center" |
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
private ArrayList<Subject> prepareData() { | |
ArrayList<Subject> subjects = new ArrayList<Subject>(); | |
Subject physics = new Subject(); | |
physics.id = 1; | |
physics.subjectName = "Physics"; | |
physics.chapters = new ArrayList<Chapter>(); | |
Chapter chapter1 = new Chapter(); | |
chapter1.id = 1; |
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
<?xml version="1.0" encoding="utf-8"?> | |
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | |
android:layout_width="match_parent" | |
android:layout_height="wrap_content" | |
android:orientation="vertical"> | |
<LinearLayout | |
android:orientation="vertical" | |
android:background="#FFFFFF" | |
android:layout_width="match_parent" |
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
<?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:tools="http://schemas.android.com/tools" | |
android:layout_width="match_parent" | |
android:layout_height="match_parent" | |
tools:context="com.ashishkudale.list_in_list.HomeActivity"> | |
<android.support.v7.widget.RecyclerView | |
android:id="@+id/rvSubject" |
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 ChapterAdapter extends RecyclerView.Adapter<ChapterAdapter.CustomViewHolder> { | |
private Context context; | |
private ArrayList<Chapter> chapters; | |
private LayoutInflater inflater; | |
public ChapterAdapter(Context context, ArrayList<Chapter> chapters) { | |
this.context = context; | |
this.chapters = chapters; | |
this.inflater = LayoutInflater.from(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 SubjectAdapter extends RecyclerView.Adapter<SubjectAdapter.ViewHolder> { | |
public ArrayList<Subject> subjects; | |
private Context context; | |
private LayoutInflater layoutInflater; | |
public SubjectAdapter(ArrayList<Subject> subjects, Context context) { | |
this.subjects = subjects; | |
this.context = context; | |
this.layoutInflater = LayoutInflater.from(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 HomeActivity extends AppCompatActivity { | |
private RecyclerView rvSubject; | |
private SubjectAdapter subjectAdapter; | |
private ArrayList<Subject> subjects; | |
@Override | |
protected void onCreate(Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
setContentView(R.layout.activity_main); |
OlderNewer