fixed 2 crashes in details screen
This commit is contained in:
@@ -4,4 +4,6 @@
|
||||
* Changed about fragment appearance
|
||||
* Fixed NPE when rotating device in BookDetail fragment by retaining it
|
||||
|
||||
* Fixed crash if a book has no author
|
||||
* Fixed crash if a book has no author when adding a book
|
||||
* Fixed crash in details view when book has no author
|
||||
* Fixed crash on configuration change in details screen (caused by ActionProvider)
|
||||
@@ -97,11 +97,13 @@ public class BookDetail extends Fragment implements LoaderManager.LoaderCallback
|
||||
bookTitle = data.getString(data.getColumnIndex(AlexandriaContract.BookEntry.TITLE));
|
||||
((TextView) rootView.findViewById(R.id.fullBookTitle)).setText(bookTitle);
|
||||
|
||||
if(shareActionProvider != null) {
|
||||
Intent shareIntent = new Intent(Intent.ACTION_SEND);
|
||||
shareIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_DOCUMENT);
|
||||
shareIntent.setType("text/plain");
|
||||
shareIntent.putExtra(Intent.EXTRA_TEXT, getString(R.string.share_text) + bookTitle);
|
||||
shareActionProvider.setShareIntent(shareIntent);
|
||||
}
|
||||
|
||||
String bookSubTitle = data.getString(data.getColumnIndex(AlexandriaContract.BookEntry.SUBTITLE));
|
||||
((TextView) rootView.findViewById(R.id.fullBookSubTitle)).setText(bookSubTitle);
|
||||
@@ -110,6 +112,8 @@ public class BookDetail extends Fragment implements LoaderManager.LoaderCallback
|
||||
((TextView) rootView.findViewById(R.id.fullBookDesc)).setText(desc);
|
||||
|
||||
String authors = data.getString(data.getColumnIndex(AlexandriaContract.AuthorEntry.AUTHOR));
|
||||
if(authors == null)
|
||||
authors = "";
|
||||
String[] authorsArr = authors.split(",");
|
||||
((TextView) rootView.findViewById(R.id.authors)).setLines(authorsArr.length);
|
||||
((TextView) rootView.findViewById(R.id.authors)).setText(authors.replace(",","\n"));
|
||||
|
||||
Reference in New Issue
Block a user