SHOW:
|
|
- or go back to the newest paste.
1 | public class AboutFragment extends Fragment { | |
2 | ||
3 | @Inject | |
4 | Bus mBus; | |
5 | ||
6 | /** | |
7 | * The fragment argument representing the section number | |
8 | * for this fragment. | |
9 | */ | |
10 | public static final String ARG_SECTION_NUMBER = "section_number"; | |
11 | ||
12 | public static AboutFragment newInstance(int sectionNumber) { | |
13 | AboutFragment fragment = new AboutFragment(); | |
14 | Bundle args = new Bundle(); | |
15 | args.putInt(ARG_SECTION_NUMBER, sectionNumber); | |
16 | fragment.setArguments(args) | |
17 | return fragment; | |
18 | } | |
19 | ||
20 | public AboutFragment() { | |
21 | // Required empty public constructor | |
22 | } | |
23 | ||
24 | @Override | |
25 | public void onCreate(final Bundle savedInstanceState) { | |
26 | super.onCreate(savedInstanceState); | |
27 | - | Injector.inject(this); |
27 | + | |
28 | ||
29 | @Override | |
30 | public View onCreateView(LayoutInflater inflater, ViewGroup container, | |
31 | Bundle savedInstanceState) { | |
32 | return inflater.inflate(R.layout.fragment_about, container, false); | |
33 | } | |
34 | ||
35 | @Override | |
36 | public void onAttach(Activity activity) { | |
37 | super.onAttach(activity); | |
38 | Injector.inject(this); // Must be called here instead of in onCreate() | |
39 | int sectionNumber = getArguments().getInt(ARG_SECTION_NUMBER); | |
40 | if (mBus == null) { | |
41 | Log.e(getClass().getName(), "OTTO has not arrived here"); | |
42 | } else { | |
43 | mBus.post(new AboutFragmentAttachedEvent(sectionNumber)); | |
44 | } | |
45 | // onSectionAttachedCallback(activity); | |
46 | } | |
47 | ||
48 | } |