mirror of
https://github.com/MinimalBible/MinimalBible
synced 2024-11-04 23:28:19 -05:00
Quick NPE fix
This commit is contained in:
parent
d685beaae6
commit
021cf1359d
@ -99,7 +99,7 @@ public class BookItemHolder {
|
||||
if (didRemove) {
|
||||
isDownloaded.setImageResource(R.drawable.ic_action_download);
|
||||
} else {
|
||||
Toast.makeText(ctx, "Unable to remove book, might need to restart the application."
|
||||
Toast.makeText(ctx, ctx.getText(R.string.book_removal_failure)
|
||||
, Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
} else {
|
||||
|
@ -149,7 +149,7 @@ public class BibleViewer extends BaseActivity implements
|
||||
Log.d("BibleViewer", "Initializing main book: " + b.getName());
|
||||
Log.d("MainThread?", Boolean.toString(Looper.myLooper() == Looper.getMainLooper()));
|
||||
FragmentManager fragmentManager = getSupportFragmentManager();
|
||||
Fragment f = BookFragment.newInstance(b.getName(), this);
|
||||
Fragment f = BookFragment.newInstance(b.getName());
|
||||
fragmentManager.beginTransaction()
|
||||
.replace(R.id.container, f)
|
||||
.commit();
|
||||
|
@ -30,8 +30,6 @@ import static org.crosswire.jsword.versification.system.Versifications.instance;
|
||||
* A placeholder fragment containing a simple view.
|
||||
*/
|
||||
public class BookFragment extends BaseFragment {
|
||||
Injector i;
|
||||
|
||||
@Inject @Named("MainBook") Book mBook;
|
||||
|
||||
@InjectView(R.id.book_content)
|
||||
@ -42,9 +40,8 @@ public class BookFragment extends BaseFragment {
|
||||
/**
|
||||
* Returns a new instance of this fragment for the given section number.
|
||||
*/
|
||||
public static BookFragment newInstance(String bookName, Injector injector) {
|
||||
public static BookFragment newInstance(String bookName) {
|
||||
BookFragment fragment = new BookFragment();
|
||||
fragment.i = injector;
|
||||
Bundle args = new Bundle();
|
||||
args.putString(ARG_BOOK_NAME, bookName);
|
||||
fragment.setArguments(args);
|
||||
@ -65,7 +62,7 @@ public class BookFragment extends BaseFragment {
|
||||
Bundle savedInstanceState) {
|
||||
View rootView = inflater.inflate(R.layout.fragment_viewer_main, container,
|
||||
false);
|
||||
i.inject(this);
|
||||
((Injector)getActivity()).inject(this);
|
||||
ButterKnife.inject(this, rootView);
|
||||
mainContent.getSettings().setJavaScriptEnabled(true);
|
||||
|
||||
|
@ -11,4 +11,6 @@
|
||||
<string name="action_settings">Settings</string>
|
||||
<string name="activity_downloader">Downloads</string>
|
||||
|
||||
<string name="book_removal_failure">Could not remove book. Try restarting application?</string>
|
||||
|
||||
</resources>
|
||||
|
Loading…
Reference in New Issue
Block a user