-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathShowMsg.java
90 lines (82 loc) · 3.19 KB
/
ShowMsg.java
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
package edu.nctu.wirelab.testsignalv1;
import android.support.v7.app.ActionBarActivity;
import android.os.Bundle;
import android.text.method.ScrollingMovementMethod;
import android.widget.TextView;
public class ShowMsg extends ActionBarActivity {
public static final String AtCellInfo = "AtCellInfo";
public static final String PhoneState = "PhoneState";
public static final String AllCellInfo = "AllCellInfo";
public static final String TrafficInfo = "TrafficInfo";
private static TextView AtInfoContent;
private static TextView PhoneStateContent;
private static TextView AllCellInfoContent;
private static TextView TrafficContent;
private static String AtInfoString = null;
private static String PhoneStateString = null;
private static String AllCellInfoString = null;
private static String TrafficString = null;
private static boolean isLive = false;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_show_msg);
initVar();
isLive = true;
}
@Override
protected void onPause(){
super.onPause();
isLive = false;
}
@Override
protected void onStop(){
super.onStop();
isLive = false;
}
@Override
protected void onDestroy(){
super.onDestroy();
isLive = false;
}
@Override
protected void onResume(){
super.onResume();
isLive = true;
if( AtInfoString!=null ) AtInfoContent.setText(AtInfoString);
if( PhoneStateString!=null ) PhoneStateContent.setText(PhoneStateString);
if( AllCellInfoString!=null ) AllCellInfoContent.setText(AllCellInfoString);
if( TrafficString!=null ) TrafficContent.setText(TrafficString);
}
public static void NoticeChange( String WhoKnock, String Msg ){
switch(WhoKnock){
case AtCellInfo:
AtInfoString = Msg;
if( isLive ) AtInfoContent.setText(Msg);
break;
case PhoneState:
PhoneStateString = Msg;
if( isLive ) PhoneStateContent.setText(Msg);
break;
case AllCellInfo:
AllCellInfoString = Msg;
if( isLive ) AllCellInfoContent.setText(Msg);
break;
case TrafficInfo:
TrafficString = Msg;
if( isLive ) TrafficContent.setText(Msg);
break;
}
}
public void initVar(){
AtInfoContent = (TextView)findViewById(R.id.AtInfoContent);
PhoneStateContent = (TextView)findViewById(R.id.PhoneStateContent);
AllCellInfoContent = (TextView)findViewById(R.id.AllCellInfoContent);
TrafficContent = (TextView)findViewById(R.id.TrafficContent);
if( AtInfoString!=null ) AtInfoContent.setText(AtInfoString);
if( PhoneStateString!=null ) PhoneStateContent.setText(PhoneStateString);
if( AllCellInfoString!=null ) AllCellInfoContent.setText(AllCellInfoString);
if( TrafficString!=null ) TrafficContent.setText(TrafficString);
AllCellInfoContent.setMovementMethod(new ScrollingMovementMethod());
}
}