|
@@ -23,8 +23,10 @@ import androidx.recyclerview.widget.LinearLayoutManager;
|
|
|
|
|
|
import com.compdfkit.core.common.CPDFDocumentException;
|
|
|
import com.compdfkit.core.document.CPDFDocument;
|
|
|
+import com.compdfkit.core.document.CPDFInfo;
|
|
|
import com.compdfkit.pdfviewer.R;
|
|
|
import com.compdfkit.pdfviewer.databinding.FragmentDocumentListBinding;
|
|
|
+import com.compdfkit.pdfviewer.home.datas.FunDatas;
|
|
|
import com.compdfkit.pdfviewer.home.samples.SamplesFactory;
|
|
|
import com.compdfkit.tools.common.utils.CFileUtils;
|
|
|
import com.compdfkit.tools.common.utils.activitycontracts.CSelectPDFDocumentResultContract;
|
|
@@ -94,6 +96,11 @@ public class DocumentListFragment extends Fragment {
|
|
|
blankPageDialogFragment.setOnEditDoneCallback(() -> {
|
|
|
try {
|
|
|
// create document
|
|
|
+ if (document.getInfo() != null) {
|
|
|
+ CPDFInfo info = document.getInfo();
|
|
|
+ info.setAuthor(getString(R.string.tools_compdfkit_author));
|
|
|
+ document.setInfo(info);
|
|
|
+ }
|
|
|
String fileName = "SampleBlankPDF.pdf";
|
|
|
File pdfFile = new File(getContext().getCacheDir(), CFileUtils.CACHE_FOLDER + File.separator + fileName);
|
|
|
pdfFile = CFileUtils.renameNameSuffix(pdfFile);
|
|
@@ -125,7 +132,7 @@ public class DocumentListFragment extends Fragment {
|
|
|
*/
|
|
|
private void initDocumentList() {
|
|
|
funListAdapter = new CHomeFunListAdapter();
|
|
|
- funListAdapter.setList(getDocumentList());
|
|
|
+ funListAdapter.setList(FunDatas.getDocumentListByFunType(getContext(), funType));
|
|
|
binding.recyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
|
|
|
binding.recyclerView.setAdapter(funListAdapter);
|
|
|
funListAdapter.setOnItemClickListener((adapter, view, position) -> {
|
|
@@ -137,13 +144,6 @@ public class DocumentListFragment extends Fragment {
|
|
|
});
|
|
|
}
|
|
|
|
|
|
- public List<HomeFunBean> getDocumentList() {
|
|
|
- return Arrays.asList(
|
|
|
- HomeFunBean.head(getContext(), R.string.tools_click_to_open_process),
|
|
|
- HomeFunBean.assetsFile(getContext(), "PDF32000_2008.pdf")
|
|
|
- );
|
|
|
- }
|
|
|
-
|
|
|
private void enterFunctions(String filePath, Uri uri) {
|
|
|
SamplesFactory factory = new SamplesFactory(this, filePath, uri);
|
|
|
factory.getImpl(funType).run();
|