package com.izrik.index;

import android.content.Intent;
import android.os.Bundle;
import android.support.design.widget.FloatingActionButton;
import android.support.design.widget.Snackbar;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.ListView;

import com.izrik.index.books.Books;

public class ReadChapterActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_read_chapter);

        Intent intent = getIntent();
        Book book = Books.Gen;
        Chapter chapter = book.getChapters().get(0);
        if (intent != null) {
            int bookIndex = intent.getIntExtra("bookIndex", 0);
            book = Books.AllBooks[bookIndex];
            int chapterIndex = intent.getIntExtra("chapterIndex", 0);
            chapter = book.getChapters().get(chapterIndex);
        }

        ArrayAdapter<Verse> adapter = new ArrayAdapter<Verse>(this, R.layout.verse_list_entry, R.id.verse_content, chapter.getVerses());
        ListView listView = (ListView)findViewById(R.id.verse_list);
        listView.setAdapter(adapter);
    }
}

@@ -46,40 +46,160 @@
 ent.
-Intent;%0Aimport android.os.Bundle
+Context;%0Aimport android.content.Intent;%0Aimport android.os.Bundle;%0Aimport android.support.annotation.LayoutRes;%0Aimport android.support.annotation.NonNull
 ;%0Aim
@@ -419,16 +419,47 @@
 w.View;%0A
+import android.view.ViewGroup;%0A
 import a
@@ -517,16 +517,48 @@
 istView;
+%0Aimport android.widget.TextView;
 %0A%0Aimport
@@ -1266,16 +1266,21 @@
 r = new 
+Verse
 ArrayAda
@@ -1283,23 +1283,16 @@
 yAdapter
-%3CVerse%3E
 (this, R
@@ -1321,88 +1321,622 @@
 ry, 
-R.id.verse_content, chapter.getVerses());%0A        ListView listView = (Lis
+chapter);%0A        ListView listView = (ListView)findViewById(R.id.verse_list);%0A        listView.setAdapter(adapter);%0A    %7D%0A%0A    class VerseArrayAdapter extends ArrayAdapter%3CVerse%3E %7B%0A        public VerseArrayAdapter(@NonNull Context context, @LayoutRes int resource, Chapter chapter) %7B%0A            super(context, resource, R.id.verse_content, chapter.getVerses());%0A        %7D%0A%0A        @NonNull%0A        @Override%0A        public View getView(int position, View convertView, ViewGroup parent) %7B%0A            View view = super.getView(position, convertView, parent);%0A            TextView verseNumberView = (Tex
 tView)
+view.
 find
@@ -1947,36 +1947,38 @@
 ById(R.id.verse_
-list
+number
 );%0A        listV
@@ -1976,37 +1976,126 @@
     
-listView.setAdapter(adapter);
+    verseNumberView.setText(Integer.toString(getItem(position).getVerseIndex()+1));%0A            return view;%0A        %7D
 %0A   

Set the verse number.