简报页

chengzhenyu преди 8 години
родител
ревизия
2afb4edded

+ 11 - 1
app/src/main/java/ai/pai/lensman/briefs/BriefsActivity.java

@@ -50,10 +50,20 @@ public class BriefsActivity extends BaseActivity implements BriefsContract.View{
50 50
         };
51 51
         orderMsgSwitch.setFactory(factory);
52 52
         systemMsgSwitch.setFactory(factory);
53
-        presenter = new BriefsPresenter(this);
53
+        presenter = new BriefsPresenter(this,this);
54 54
         presenter.start();
55 55
     }
56 56
 
57
+    @OnClick(R.id.switcher_order_msg)
58
+    public void clickOrderMsg(){
59
+        presenter.clickCurrentOrderMsg();
60
+    }
61
+
62
+    @OnClick(R.id.switcher_system_msg)
63
+    public void clickSysMsg(){
64
+        presenter.clickCurrentSysMsg();
65
+    }
66
+
57 67
     @OnClick(R.id.title_bar_back_layout)
58 68
     void back(){
59 69
         finish();

+ 2 - 1
app/src/main/java/ai/pai/lensman/briefs/BriefsContract.java

@@ -16,7 +16,8 @@ public class BriefsContract {
16 16
     }
17 17
 
18 18
     public interface Presenter extends BasePresenter{
19
-
19
+        void clickCurrentOrderMsg();
20
+        void clickCurrentSysMsg();
20 21
     }
21 22
 
22 23
 

+ 31 - 2
app/src/main/java/ai/pai/lensman/briefs/BriefsPresenter.java

@@ -1,5 +1,8 @@
1 1
 package ai.pai.lensman.briefs;
2 2
 
3
+import android.content.Context;
4
+import android.content.Intent;
5
+
3 6
 import com.android.common.utils.NetworkUtil;
4 7
 
5 8
 import java.util.Random;
@@ -8,14 +11,17 @@ import java.util.TimerTask;
8 11
 
9 12
 import ai.pai.lensman.App;
10 13
 import ai.pai.lensman.R;
14
+import ai.pai.lensman.activities.WebViewActivity;
11 15
 import ai.pai.lensman.base.BaseInteractor;
12 16
 import ai.pai.lensman.bean.BriefsBean;
13 17
 import ai.pai.lensman.bean.MessageBean;
14 18
 import ai.pai.lensman.bean.SystemMessageBean;
15 19
 import ai.pai.lensman.main.QueryBoxStatusInteractor;
16 20
 
17
-public class BriefsPresenter implements BriefsContract.Presenter,BaseInteractor.InteractorListener<BriefsBean>,QueryBoxStatusInteractor.BoxStatusListener {
21
+public class BriefsPresenter implements BriefsContract.Presenter,BaseInteractor.InteractorListener<BriefsBean>,
22
+        QueryBoxStatusInteractor.BoxStatusListener {
18 23
 
24
+    private Context context;
19 25
     private BriefsContract.View briefsView;
20 26
     private BriefsInteractor interactor;
21 27
     private QueryBoxStatusInteractor boxStatusInteractor;
@@ -27,7 +33,8 @@ public class BriefsPresenter implements BriefsContract.Presenter,BaseInteractor.
27 33
     private SystemMessageBean currentSystemMsg;
28 34
 
29 35
 
30
-    public BriefsPresenter(BriefsContract.View briefsView){
36
+    public BriefsPresenter(Context context,BriefsContract.View briefsView){
37
+        this.context = context;
31 38
         this.briefsView = briefsView;
32 39
         interactor = new BriefsInteractor(this);
33 40
         boxStatusInteractor = new QueryBoxStatusInteractor(this);
@@ -100,4 +107,26 @@ public class BriefsPresenter implements BriefsContract.Presenter,BaseInteractor.
100 107
     public void onBoxStatusFetched(String boxNo, String boxStatus, String boxStatusCode) {
101 108
         briefsView.updateBoxInfo(boxNo,boxStatus+"("+boxStatusCode+")");
102 109
     }
110
+
111
+    @Override
112
+    public void clickCurrentOrderMsg() {
113
+        if(currentMsg==null){
114
+            return;
115
+        }
116
+
117
+    }
118
+
119
+    @Override
120
+    public void clickCurrentSysMsg() {
121
+        if(currentSystemMsg==null){
122
+            return;
123
+        }
124
+        if(currentSystemMsg.url == null){
125
+            return;
126
+        }
127
+        Intent declareIntent = new Intent(context,WebViewActivity.class);
128
+        declareIntent.putExtra("url",currentSystemMsg.url);
129
+        declareIntent.putExtra("title",currentSystemMsg.title);
130
+        context.startActivity(declareIntent);
131
+    }
103 132
 }