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