diff --git a/component/viewer/src/main/java/one/nem/lacerta/component/viewer/ComponentViewerTopFragment.java b/component/viewer/src/main/java/one/nem/lacerta/component/viewer/ComponentViewerTopFragment.java index e368b703..246c9a45 100644 --- a/component/viewer/src/main/java/one/nem/lacerta/component/viewer/ComponentViewerTopFragment.java +++ b/component/viewer/src/main/java/one/nem/lacerta/component/viewer/ComponentViewerTopFragment.java @@ -1,20 +1,36 @@ package one.nem.lacerta.component.viewer; +import android.graphics.Bitmap; import android.os.Bundle; import androidx.fragment.app.Fragment; +import androidx.recyclerview.widget.LinearLayoutManager; +import androidx.recyclerview.widget.RecyclerView; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; +import java.util.ArrayList; + +import javax.inject.Inject; + +import dagger.hilt.android.AndroidEntryPoint; +import one.nem.lacerta.data.Document; +import one.nem.lacerta.model.document.DocumentDetail; +import one.nem.lacerta.model.document.page.Page; + /** * A simple {@link Fragment} subclass. * Use the {@link ComponentViewerTopFragment#newInstance} factory method to * create an instance of this fragment. */ +@AndroidEntryPoint public class ComponentViewerTopFragment extends Fragment { + @Inject + Document document; + private static final String TAG = "ComponentViewerTopFragment"; private String documentId; @@ -43,6 +59,18 @@ public class ComponentViewerTopFragment extends Fragment { public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment - return inflater.inflate(R.layout.fragment_component_viewer_top, container, false); + View view = inflater.inflate(R.layout.fragment_component_viewer_top, container, false); + + DocumentDetail documentDetail = document.getDocument(documentId); + + ArrayList documentPages = new ArrayList<>(); + documentPages = documentDetail.getPages(); + + RecyclerView recyclerView = view.findViewById(R.id.body_recycler_view); + recyclerView.setLayoutManager(new LinearLayoutManager(getContext())); + ViewerBodyAdapter viewerBodyAdapter = new ViewerBodyAdapter(documentPages); + recyclerView.setAdapter(viewerBodyAdapter); + + return view; } } \ No newline at end of file diff --git a/component/viewer/src/main/java/one/nem/lacerta/component/viewer/ViewerBodyAdapter.java b/component/viewer/src/main/java/one/nem/lacerta/component/viewer/ViewerBodyAdapter.java index 7bd52ace..5494c847 100644 --- a/component/viewer/src/main/java/one/nem/lacerta/component/viewer/ViewerBodyAdapter.java +++ b/component/viewer/src/main/java/one/nem/lacerta/component/viewer/ViewerBodyAdapter.java @@ -11,12 +11,14 @@ import androidx.recyclerview.widget.RecyclerView; import java.util.ArrayList; +import one.nem.lacerta.model.document.page.Page; + public class ViewerBodyAdapter extends RecyclerView.Adapter{ - ArrayList images; + ArrayList pages; - public ViewerBodyAdapter(ArrayList images){ - this.images = images; + public ViewerBodyAdapter(ArrayList pages){ + this.pages = pages; } @NonNull @@ -28,12 +30,13 @@ public class ViewerBodyAdapter extends RecyclerView.Adapter + + + + \ No newline at end of file