Commit 9cd738be06d49da7334a76446f1d72e143a97b4a
1 parent
ce26434c
Exists in
yxb_dev
and in
2 other branches
no message
Showing
9 changed files
with
105 additions
and
94 deletions
Show diff stats
app/src/main/java/com/shunzhi/parent/contract/loginandregister/LoginAndRegisterContract.java
0 → 100644
@@ -0,0 +1,39 @@ | @@ -0,0 +1,39 @@ | ||
1 | +package com.shunzhi.parent.contract.loginandregister; | ||
2 | + | ||
3 | +import com.share.mvpsdk.base.BasePresenter; | ||
4 | +import com.share.mvpsdk.base.IBaseFragment; | ||
5 | +import com.share.mvpsdk.base.IBaseModel; | ||
6 | + | ||
7 | +/** | ||
8 | + * Created by Administrator on 2018/3/6 0006. | ||
9 | + */ | ||
10 | + | ||
11 | +public interface LoginAndRegisterContract { | ||
12 | + | ||
13 | + abstract class LoginPresenter extends BasePresenter<ILoginModel,ILoginView>{ | ||
14 | + public abstract void loginResult(String loginName,String loginPwd); | ||
15 | + | ||
16 | + public abstract void getUserInfo(); | ||
17 | + } | ||
18 | + | ||
19 | + interface ILoginModel extends IBaseModel{ | ||
20 | + | ||
21 | + } | ||
22 | + interface ILoginView extends IBaseFragment { | ||
23 | + | ||
24 | + //显示网络错误 | ||
25 | + void showNetworkError(); | ||
26 | + | ||
27 | + //显示加载更多错误 | ||
28 | + void showLoadMoreError(); | ||
29 | + | ||
30 | + //显示没有更多数据 | ||
31 | + void showNomoreData(); | ||
32 | + | ||
33 | + //更新用户信息 | ||
34 | + void getUserInfo(); | ||
35 | + | ||
36 | + } | ||
37 | + | ||
38 | + | ||
39 | +} |
app/src/main/java/com/shunzhi/parent/model/loginandregister/loginAndRegisterModel.java
0 → 100644
app/src/main/java/com/shunzhi/parent/presenter/loginandregister/LoginAndRegisterPresenter.java
0 → 100644
app/src/main/java/com/shunzhi/parent/ui/activity/LoginAndRegistActivity.java
1 | package com.shunzhi.parent.ui.activity; | 1 | package com.shunzhi.parent.ui.activity; |
2 | 2 | ||
3 | -import android.support.v7.app.AppCompatActivity; | ||
4 | import android.os.Bundle; | 3 | import android.os.Bundle; |
4 | +import android.support.v4.app.FragmentTransaction; | ||
5 | +import android.support.v7.app.AppCompatActivity; | ||
5 | 6 | ||
6 | import com.shunzhi.parent.R; | 7 | import com.shunzhi.parent.R; |
8 | +import com.shunzhi.parent.ui.fragment.loginandregistfragment.LoginAndRegistFragment; | ||
7 | 9 | ||
8 | public class LoginAndRegistActivity extends AppCompatActivity { | 10 | public class LoginAndRegistActivity extends AppCompatActivity { |
9 | 11 | ||
12 | + LoginAndRegistFragment loginAndRegistFragment = new LoginAndRegistFragment(); | ||
13 | + FragmentTransaction ft; | ||
14 | + | ||
15 | + | ||
10 | @Override | 16 | @Override |
11 | protected void onCreate(Bundle savedInstanceState) { | 17 | protected void onCreate(Bundle savedInstanceState) { |
12 | super.onCreate(savedInstanceState); | 18 | super.onCreate(savedInstanceState); |
13 | setContentView(R.layout.activity_regist); | 19 | setContentView(R.layout.activity_regist); |
20 | + initViews(); | ||
14 | } | 21 | } |
22 | + | ||
23 | + private void initViews() { | ||
24 | + ft = getSupportFragmentManager().beginTransaction(); | ||
25 | + ft.add(R.id.frame, loginAndRegistFragment); | ||
26 | + ft.commit(); | ||
27 | + } | ||
28 | + | ||
15 | } | 29 | } |
app/src/main/java/com/shunzhi/parent/ui/fragment/CePingFragment.java
@@ -13,7 +13,7 @@ import com.shunzhi.parent.R; | @@ -13,7 +13,7 @@ import com.shunzhi.parent.R; | ||
13 | /** | 13 | /** |
14 | * A simple {@link Fragment} subclass. | 14 | * A simple {@link Fragment} subclass. |
15 | * Activities that contain this fragment must implement the | 15 | * Activities that contain this fragment must implement the |
16 | - * {@link CePingFragment.OnFragmentInteractionListener} interface | 16 | + * {@link OnFragmentInteractionListener} interface |
17 | * to handle interaction events. | 17 | * to handle interaction events. |
18 | * Use the {@link CePingFragment#newInstance} factory method to | 18 | * Use the {@link CePingFragment#newInstance} factory method to |
19 | * create an instance of this fragment. | 19 | * create an instance of this fragment. |
app/src/main/java/com/shunzhi/parent/ui/fragment/ConsultFragment.java
@@ -13,7 +13,7 @@ import com.shunzhi.parent.R; | @@ -13,7 +13,7 @@ import com.shunzhi.parent.R; | ||
13 | /** | 13 | /** |
14 | * A simple {@link Fragment} subclass. | 14 | * A simple {@link Fragment} subclass. |
15 | * Activities that contain this fragment must implement the | 15 | * Activities that contain this fragment must implement the |
16 | - * {@link ConsultFragment.OnFragmentInteractionListener} interface | 16 | + * {@link OnFragmentInteractionListener} interface |
17 | * to handle interaction events. | 17 | * to handle interaction events. |
18 | * Use the {@link ConsultFragment#newInstance} factory method to | 18 | * Use the {@link ConsultFragment#newInstance} factory method to |
19 | * create an instance of this fragment. | 19 | * create an instance of this fragment. |
app/src/main/java/com/shunzhi/parent/ui/fragment/MineFragment.java
@@ -13,7 +13,7 @@ import com.shunzhi.parent.R; | @@ -13,7 +13,7 @@ import com.shunzhi.parent.R; | ||
13 | /** | 13 | /** |
14 | * A simple {@link Fragment} subclass. | 14 | * A simple {@link Fragment} subclass. |
15 | * Activities that contain this fragment must implement the | 15 | * Activities that contain this fragment must implement the |
16 | - * {@link MineFragment.OnFragmentInteractionListener} interface | 16 | + * {@link OnFragmentInteractionListener} interface |
17 | * to handle interaction events. | 17 | * to handle interaction events. |
18 | * Use the {@link MineFragment#newInstance} factory method to | 18 | * Use the {@link MineFragment#newInstance} factory method to |
19 | * create an instance of this fragment. | 19 | * create an instance of this fragment. |
app/src/main/java/com/shunzhi/parent/ui/fragment/ReportFragment.java
@@ -13,7 +13,7 @@ import com.shunzhi.parent.R; | @@ -13,7 +13,7 @@ import com.shunzhi.parent.R; | ||
13 | /** | 13 | /** |
14 | * A simple {@link Fragment} subclass. | 14 | * A simple {@link Fragment} subclass. |
15 | * Activities that contain this fragment must implement the | 15 | * Activities that contain this fragment must implement the |
16 | - * {@link ReportFragment.OnFragmentInteractionListener} interface | 16 | + * {@link OnFragmentInteractionListener} interface |
17 | * to handle interaction events. | 17 | * to handle interaction events. |
18 | * Use the {@link ReportFragment#newInstance} factory method to | 18 | * Use the {@link ReportFragment#newInstance} factory method to |
19 | * create an instance of this fragment. | 19 | * create an instance of this fragment. |
app/src/main/java/com/shunzhi/parent/ui/fragment/loginandregistfragment/LoginAndRegistFragment.java
1 | package com.shunzhi.parent.ui.fragment.loginandregistfragment; | 1 | package com.shunzhi.parent.ui.fragment.loginandregistfragment; |
2 | 2 | ||
3 | -import android.content.Context; | ||
4 | -import android.net.Uri; | ||
5 | import android.os.Bundle; | 3 | import android.os.Bundle; |
6 | -import android.support.v4.app.Fragment; | ||
7 | -import android.view.LayoutInflater; | 4 | +import android.support.annotation.NonNull; |
5 | +import android.support.annotation.Nullable; | ||
8 | import android.view.View; | 6 | import android.view.View; |
9 | -import android.view.ViewGroup; | ||
10 | 7 | ||
8 | +import com.share.mvpsdk.base.BasePresenter; | ||
9 | +import com.share.mvpsdk.base.fragment.BaseMVPCompatFragment; | ||
11 | import com.shunzhi.parent.R; | 10 | import com.shunzhi.parent.R; |
11 | +import com.shunzhi.parent.contract.loginandregister.LoginAndRegisterContract; | ||
12 | 12 | ||
13 | -/** | ||
14 | - * A simple {@link Fragment} subclass. | ||
15 | - * Activities that contain this fragment must implement the | ||
16 | - * {@link LoginAndRegistFragment.OnFragmentInteractionListener} interface | ||
17 | - * to handle interaction events. | ||
18 | - * Use the {@link LoginAndRegistFragment#newInstance} factory method to | ||
19 | - * create an instance of this fragment. | ||
20 | - */ | ||
21 | -public class LoginAndRegistFragment extends Fragment { | ||
22 | - // TODO: Rename parameter arguments, choose names that match | ||
23 | - // the fragment initialization parameters, e.g. ARG_ITEM_NUMBER | ||
24 | - private static final String ARG_PARAM1 = "param1"; | ||
25 | - private static final String ARG_PARAM2 = "param2"; | ||
26 | - | ||
27 | - // TODO: Rename and change types of parameters | ||
28 | - private String mParam1; | ||
29 | - private String mParam2; | ||
30 | - | ||
31 | - private OnFragmentInteractionListener mListener; | ||
32 | - | ||
33 | - public LoginAndRegistFragment() { | ||
34 | - // Required empty public constructor | ||
35 | - } | ||
36 | 13 | ||
37 | - /** | ||
38 | - * Use this factory method to create a new instance of | ||
39 | - * this fragment using the provided parameters. | ||
40 | - * | ||
41 | - * @param param1 Parameter 1. | ||
42 | - * @param param2 Parameter 2. | ||
43 | - * @return A new instance of fragment LoginAndRegistFragment. | ||
44 | - */ | ||
45 | - // TODO: Rename and change types and number of parameters | ||
46 | - public static LoginAndRegistFragment newInstance(String param1, String param2) { | ||
47 | - LoginAndRegistFragment fragment = new LoginAndRegistFragment(); | ||
48 | - Bundle args = new Bundle(); | ||
49 | - args.putString(ARG_PARAM1, param1); | ||
50 | - args.putString(ARG_PARAM2, param2); | ||
51 | - fragment.setArguments(args); | ||
52 | - return fragment; | ||
53 | - } | 14 | +public class LoginAndRegistFragment extends BaseMVPCompatFragment<LoginAndRegisterContract.LoginPresenter,LoginAndRegisterContract.ILoginModel>{ |
54 | 15 | ||
55 | - @Override | ||
56 | - public void onCreate(Bundle savedInstanceState) { | ||
57 | - super.onCreate(savedInstanceState); | ||
58 | - if (getArguments() != null) { | ||
59 | - mParam1 = getArguments().getString(ARG_PARAM1); | ||
60 | - mParam2 = getArguments().getString(ARG_PARAM2); | ||
61 | - } | ||
62 | - } | ||
63 | 16 | ||
64 | - @Override | ||
65 | - public View onCreateView(LayoutInflater inflater, ViewGroup container, | ||
66 | - Bundle savedInstanceState) { | ||
67 | - // Inflate the layout for this fragment | ||
68 | - return inflater.inflate(R.layout.fragment_login_and_regist, container, false); | ||
69 | - } | 17 | +// public static LoginAndRegistFragment getInstance(){ |
18 | +// LoginAndRegistFragment loginFragment=new LoginAndRegistFragment(); | ||
19 | +// return loginFragment; | ||
20 | +// } | ||
70 | 21 | ||
71 | - // TODO: Rename method, update argument and hook method into UI event | ||
72 | - public void onButtonPressed(Uri uri) { | ||
73 | - if (mListener != null) { | ||
74 | - mListener.onFragmentInteraction(uri); | ||
75 | - } | ||
76 | - } | ||
77 | 22 | ||
23 | + @NonNull | ||
78 | @Override | 24 | @Override |
79 | - public void onAttach(Context context) { | ||
80 | - super.onAttach(context); | ||
81 | - if (context instanceof OnFragmentInteractionListener) { | ||
82 | - mListener = (OnFragmentInteractionListener) context; | ||
83 | - } else { | ||
84 | - throw new RuntimeException(context.toString() | ||
85 | - + " must implement OnFragmentInteractionListener"); | ||
86 | - } | 25 | + public BasePresenter initPresenter() { |
26 | + return null; | ||
87 | } | 27 | } |
88 | 28 | ||
89 | @Override | 29 | @Override |
90 | - public void onDetach() { | ||
91 | - super.onDetach(); | ||
92 | - mListener = null; | 30 | + public int getLayoutId() { |
31 | + return R.layout.activity_regist; | ||
93 | } | 32 | } |
94 | 33 | ||
95 | - /** | ||
96 | - * This interface must be implemented by activities that contain this | ||
97 | - * fragment to allow an interaction in this fragment to be communicated | ||
98 | - * to the activity and potentially other fragments contained in that | ||
99 | - * activity. | ||
100 | - * <p> | ||
101 | - * See the Android Training lesson <a href= | ||
102 | - * "http://developer.android.com/training/basics/fragments/communicating.html" | ||
103 | - * >Communicating with Other Fragments</a> for more information. | ||
104 | - */ | ||
105 | - public interface OnFragmentInteractionListener { | ||
106 | - // TODO: Update argument type and name | ||
107 | - void onFragmentInteraction(Uri uri); | 34 | + @Override |
35 | + public void initUI(View view, @Nullable Bundle savedInstanceState) { | ||
36 | + | ||
108 | } | 37 | } |
38 | + | ||
39 | + | ||
40 | + | ||
41 | + | ||
42 | +// @Override | ||
43 | +// public View onCreateView(LayoutInflater inflater, ViewGroup container, | ||
44 | +// Bundle savedInstanceState) { | ||
45 | +// // Inflate the layout for this fragment | ||
46 | +// return inflater.inflate(R.layout.fragment_login_and_regist, container, false); | ||
47 | +// } | ||
48 | + | ||
109 | } | 49 | } |