forked from baiiu/AndroidModule
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMainFragment.java
More file actions
52 lines (41 loc) · 1.5 KB
/
Copy pathMainFragment.java
File metadata and controls
52 lines (41 loc) · 1.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
package com.baiiu.dagger2learn.mvpSample;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import com.baiiu.dagger2learn.MainActivity;
import com.baiiu.dagger2learn.R;
import javax.inject.Inject;
/**
* author: baiiu
* date: on 16/6/13 11:33
* description:
*/
public class MainFragment extends Fragment implements IView {
private TextView textView;
@Inject MainPresenter mMainPresenter;
private MainFragmentComponent mainFragmentComponent;
@Override public void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mainFragmentComponent = ((MainActivity) getActivity()).mainComponent.mainFragmentComponent();
mainFragmentComponent.inject(this);
mMainPresenter.attachView(this);
}
@Nullable @Override public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container,
@Nullable Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_main, container, false);
textView = (TextView) view.findViewById(R.id.textView);
textView.postDelayed(new Runnable() {
@Override public void run() {
mMainPresenter.start();
}
}, 5000);
return view;
}
@Override public void showPerson(String s) {
textView.setText(s);
}
}