fixed 2 crashes in details screen
This commit is contained in:
@@ -4,4 +4,6 @@
|
|||||||
* Changed about fragment appearance
|
* Changed about fragment appearance
|
||||||
* Fixed NPE when rotating device in BookDetail fragment by retaining it
|
* 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));
|
bookTitle = data.getString(data.getColumnIndex(AlexandriaContract.BookEntry.TITLE));
|
||||||
((TextView) rootView.findViewById(R.id.fullBookTitle)).setText(bookTitle);
|
((TextView) rootView.findViewById(R.id.fullBookTitle)).setText(bookTitle);
|
||||||
|
|
||||||
Intent shareIntent = new Intent(Intent.ACTION_SEND);
|
if(shareActionProvider != null) {
|
||||||
shareIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_DOCUMENT);
|
Intent shareIntent = new Intent(Intent.ACTION_SEND);
|
||||||
shareIntent.setType("text/plain");
|
shareIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_DOCUMENT);
|
||||||
shareIntent.putExtra(Intent.EXTRA_TEXT, getString(R.string.share_text)+bookTitle);
|
shareIntent.setType("text/plain");
|
||||||
shareActionProvider.setShareIntent(shareIntent);
|
shareIntent.putExtra(Intent.EXTRA_TEXT, getString(R.string.share_text) + bookTitle);
|
||||||
|
shareActionProvider.setShareIntent(shareIntent);
|
||||||
|
}
|
||||||
|
|
||||||
String bookSubTitle = data.getString(data.getColumnIndex(AlexandriaContract.BookEntry.SUBTITLE));
|
String bookSubTitle = data.getString(data.getColumnIndex(AlexandriaContract.BookEntry.SUBTITLE));
|
||||||
((TextView) rootView.findViewById(R.id.fullBookSubTitle)).setText(bookSubTitle);
|
((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);
|
((TextView) rootView.findViewById(R.id.fullBookDesc)).setText(desc);
|
||||||
|
|
||||||
String authors = data.getString(data.getColumnIndex(AlexandriaContract.AuthorEntry.AUTHOR));
|
String authors = data.getString(data.getColumnIndex(AlexandriaContract.AuthorEntry.AUTHOR));
|
||||||
|
if(authors == null)
|
||||||
|
authors = "";
|
||||||
String[] authorsArr = authors.split(",");
|
String[] authorsArr = authors.split(",");
|
||||||
((TextView) rootView.findViewById(R.id.authors)).setLines(authorsArr.length);
|
((TextView) rootView.findViewById(R.id.authors)).setLines(authorsArr.length);
|
||||||
((TextView) rootView.findViewById(R.id.authors)).setText(authors.replace(",","\n"));
|
((TextView) rootView.findViewById(R.id.authors)).setText(authors.replace(",","\n"));
|
||||||
|
|||||||
Reference in New Issue
Block a user