├── README.md ├── ECGDemo ├── ic_launcher-web.png ├── libs │ └── android-support-v4.jar ├── .settings │ └── org.eclipse.core.resources.prefs ├── res │ ├── drawable-hdpi │ │ └── ic_launcher.png │ ├── drawable-mdpi │ │ └── ic_launcher.png │ ├── drawable-xhdpi │ │ └── ic_launcher.png │ ├── drawable-xxhdpi │ │ └── ic_launcher.png │ ├── values │ │ ├── dimens.xml │ │ ├── strings.xml │ │ ├── attrs.xml │ │ └── styles.xml │ ├── values-v11 │ │ └── styles.xml │ ├── menu │ │ └── main.xml │ ├── values-w820dp │ │ └── dimens.xml │ ├── values-v14 │ │ └── styles.xml │ └── layout │ │ ├── activity_main.xml │ │ └── fragment_main.xml ├── src │ └── com │ │ └── mao │ │ └── ECG │ │ ├── MainActivity.java │ │ └── ECGView.java ├── .classpath ├── project.properties ├── proguard-project.txt ├── .project └── AndroidManifest.xml └── .gitignore /README.md: -------------------------------------------------------------------------------- 1 | # ECGView 2 | 心电图 electrocardiogram view 3 | -------------------------------------------------------------------------------- /ECGDemo/ic_launcher-web.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/idmaoning/ECGView/HEAD/ECGDemo/ic_launcher-web.png -------------------------------------------------------------------------------- /ECGDemo/libs/android-support-v4.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/idmaoning/ECGView/HEAD/ECGDemo/libs/android-support-v4.jar -------------------------------------------------------------------------------- /ECGDemo/.settings/org.eclipse.core.resources.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | encoding//src/com/mao/ECG/ECGView.java=UTF-8 3 | -------------------------------------------------------------------------------- /ECGDemo/res/drawable-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/idmaoning/ECGView/HEAD/ECGDemo/res/drawable-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /ECGDemo/res/drawable-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/idmaoning/ECGView/HEAD/ECGDemo/res/drawable-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /ECGDemo/res/drawable-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/idmaoning/ECGView/HEAD/ECGDemo/res/drawable-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /ECGDemo/src/com/mao/ECG/MainActivity.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/idmaoning/ECGView/HEAD/ECGDemo/src/com/mao/ECG/MainActivity.java -------------------------------------------------------------------------------- /ECGDemo/res/drawable-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/idmaoning/ECGView/HEAD/ECGDemo/res/drawable-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /ECGDemo/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 16dp 5 | 16dp 6 | 7 | 8 | -------------------------------------------------------------------------------- /ECGDemo/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CardioTest 5 | Hello world! 6 | Settings 7 | 8 | 9 | -------------------------------------------------------------------------------- /ECGDemo/res/values-v11/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /ECGDemo/res/menu/main.xml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /ECGDemo/res/values-w820dp/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 64dp 9 | 10 | 11 | -------------------------------------------------------------------------------- /ECGDemo/res/values-v14/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /ECGDemo/res/values/attrs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /ECGDemo/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Built application files 2 | *.apk 3 | *.ap_ 4 | 5 | # Files for the Dalvik VM 6 | *.dex 7 | 8 | # Java class files 9 | *.class 10 | 11 | # Generated files 12 | bin/ 13 | gen/ 14 | 15 | # Gradle files 16 | .gradle/ 17 | build/ 18 | 19 | # Local configuration file (sdk path, etc) 20 | local.properties 21 | 22 | # Proguard folder generated by Eclipse 23 | proguard/ 24 | 25 | # Log Files 26 | *.log 27 | 28 | # Android Studio Navigation editor temp files 29 | .navigation/ 30 | 31 | # Android Studio captures folder 32 | captures/ 33 | -------------------------------------------------------------------------------- /ECGDemo/project.properties: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by Android Tools. 2 | # Do not modify this file -- YOUR CHANGES WILL BE ERASED! 3 | # 4 | # This file must be checked in Version Control Systems. 5 | # 6 | # To customize properties used by the Ant build system edit 7 | # "ant.properties", and override values to adapt the script to your 8 | # project structure. 9 | # 10 | # To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home): 11 | #proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt 12 | 13 | # Project target. 14 | target=android-19 15 | android.library.reference.1=../appcompat_v7 16 | -------------------------------------------------------------------------------- /ECGDemo/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 8 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /ECGDemo/res/layout/fragment_main.xml: -------------------------------------------------------------------------------- 1 | 10 | 11 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /ECGDemo/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 14 | 15 | 16 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /ECGDemo/proguard-project.txt: -------------------------------------------------------------------------------- 1 | # To enable ProGuard in your project, edit project.properties 2 | # to define the proguard.config property as described in that file. 3 | # 4 | # Add project specific ProGuard rules here. 5 | # By default, the flags in this file are appended to flags specified 6 | # in ${sdk.dir}/tools/proguard/proguard-android.txt 7 | # You can edit the include path and order by changing the ProGuard 8 | # include property in project.properties. 9 | # 10 | # For more details, see 11 | # http://developer.android.com/guide/developing/tools/proguard.html 12 | 13 | # Add any project specific keep options here: 14 | 15 | # If your project uses WebView with JS, uncomment the following 16 | # and specify the fully qualified class name to the JavaScript interface 17 | # class: 18 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 19 | # public *; 20 | #} 21 | -------------------------------------------------------------------------------- /ECGDemo/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | ELGDemo 4 | 5 | 6 | 7 | 8 | 9 | com.android.ide.eclipse.adt.ResourceManagerBuilder 10 | 11 | 12 | 13 | 14 | com.android.ide.eclipse.adt.PreCompilerBuilder 15 | 16 | 17 | 18 | 19 | org.eclipse.jdt.core.javabuilder 20 | 21 | 22 | 23 | 24 | com.android.ide.eclipse.adt.ApkBuilder 25 | 26 | 27 | 28 | 29 | 30 | com.android.ide.eclipse.adt.AndroidNature 31 | org.eclipse.jdt.core.javanature 32 | 33 | 34 | -------------------------------------------------------------------------------- /ECGDemo/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 10 | 11 | 16 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /ECGDemo/src/com/mao/ECG/ECGView.java: -------------------------------------------------------------------------------- 1 | package com.mao.ECG; 2 | 3 | import java.util.ArrayList; 4 | import java.util.HashMap; 5 | import java.util.List; 6 | import java.util.Map; 7 | import android.content.Context; 8 | import android.content.res.TypedArray; 9 | import android.graphics.Canvas; 10 | import android.graphics.Color; 11 | import android.graphics.Paint; 12 | import android.graphics.PaintFlagsDrawFilter; 13 | import android.os.Handler; 14 | import android.os.Looper; 15 | import android.text.TextPaint; 16 | import android.util.AttributeSet; 17 | import android.view.View; 18 | import android.widget.Toast; 19 | 20 | /** 21 | * @author maoning 2016/4/12 22 | */ 23 | public class ECGView extends View { 24 | private final static String X_KEY = "Xpos"; 25 | private final static String Y_KEY = "Ypos"; 26 | private final static int LOW_ALARM = 0; 27 | private final static int HIGH_ALARM = 1; 28 | private int _backLineColor; 29 | private int _titleColor; 30 | private int _pointerLineColor; 31 | private int _titleSize; 32 | private int _XYTextSize; 33 | // 屏幕上的数量 34 | private int _PointMaxAmount; 35 | private float _XUnitLength; 36 | // 当前加入点 37 | private int _CurP = 0; 38 | private int _RemovedPointNum = 0; 39 | private int _EveryNPointBold = 1; 40 | // 是否是第第一次加载背景 41 | private Boolean _isfristDrawBackGround = true; 42 | // 上下左右缩进 43 | private int _LeftIndent = 100; 44 | private int _RightIndent = 100; 45 | private int _BottomIndent = 100; 46 | private int _TopIndent = 100; 47 | private float _CurX = _LeftIndent + 4; 48 | private float _CurY = _TopIndent; 49 | // 设置每_EveryNPointRefresh个点刷新电图 50 | private int _EveryNPointRefresh = 1; 51 | private float _MaxYNumber; 52 | private int _Height; 53 | private int _Width; 54 | private float _EffectiveHeight = 1;// 有效高度 55 | private float _EffectiveWidth = 1;// 有效宽度 56 | private float _EveryOneValue = 1;// 每个格子的�? 57 | private int _LatticeWidth = 1; 58 | private List> _ListPoint = new ArrayList>(); 59 | private List _ListVLine = new ArrayList(); 60 | private List _ListHLine = new ArrayList(); 61 | private Paint _PaintLine; 62 | private Paint _PaintDataLine; 63 | private TextPaint _TitleTextPaint; 64 | private TextPaint _XYTextPaint; 65 | private String title = "心电图"; 66 | private int _YSize; 67 | private int _XSize; 68 | private Context _context; 69 | private String _lowAlarmMsg;// 低报警消�? 70 | private String _highAlarmMsg;// 高报警消�? 71 | private int _maxAlarmNumber;// �?��临界�? 72 | private int _minAlarmNumber;// �?��临界�? 73 | private boolean isSetAlarmFlag = false; 74 | private Handler _handler; 75 | 76 | public ECGView(Context context, AttributeSet attrs, 77 | int defStyle) { 78 | super(context, attrs, defStyle); 79 | _context = context; 80 | TypedArray typedArray = context.obtainStyledAttributes(attrs, 81 | R.styleable.elg); 82 | _backLineColor = typedArray.getColor(R.styleable.elg_BackLineColor, 83 | Color.GREEN); 84 | _titleColor = typedArray 85 | .getColor(R.styleable.elg_TitleColor, Color.RED); 86 | _pointerLineColor = typedArray.getColor( 87 | R.styleable.elg_PointerLineColor, Color.WHITE); 88 | _titleSize = typedArray.getDimensionPixelSize( 89 | R.styleable.elg_TitleSize, 30); 90 | _XYTextSize = typedArray.getDimensionPixelSize( 91 | R.styleable.elg_XYTextSize, 20); 92 | typedArray.recycle(); 93 | initView(); 94 | } 95 | 96 | public ECGView(Context context, AttributeSet attrs) { 97 | super(context, attrs); 98 | _context = context; 99 | TypedArray typedArray = context.obtainStyledAttributes(attrs, 100 | R.styleable.elg); 101 | _backLineColor = typedArray.getColor(R.styleable.elg_BackLineColor, 102 | Color.GREEN); 103 | _titleColor = typedArray 104 | .getColor(R.styleable.elg_TitleColor, Color.RED); 105 | _pointerLineColor = typedArray.getColor( 106 | R.styleable.elg_PointerLineColor, Color.WHITE); 107 | _titleSize = typedArray.getDimensionPixelSize( 108 | R.styleable.elg_TitleSize, 30); 109 | _XYTextSize = typedArray.getDimensionPixelSize( 110 | R.styleable.elg_XYTextSize, 20); 111 | typedArray.recycle(); 112 | initView(); 113 | } 114 | 115 | public ECGView(Context context) { 116 | this(context, null); 117 | _context = context; 118 | initView(); 119 | } 120 | 121 | private void initView() { 122 | _handler = new Handler(Looper.getMainLooper()); 123 | _PaintLine = new Paint(); 124 | _PaintLine.setStrokeWidth(2.5f); 125 | _PaintLine.setColor(_pointerLineColor); 126 | _PaintLine.setAntiAlias(true); 127 | _PaintDataLine = new Paint(); 128 | _PaintDataLine.setColor(_backLineColor); 129 | _PaintDataLine.setAntiAlias(true); 130 | _PaintDataLine.setStrokeWidth(10); 131 | _XYTextPaint = new TextPaint(); 132 | _XYTextPaint.setColor(_titleColor); 133 | _XYTextPaint.setTextSize(_XYTextSize); 134 | _TitleTextPaint = new TextPaint(); 135 | _TitleTextPaint.setColor(_titleColor); 136 | _TitleTextPaint.setTextSize(_titleSize); 137 | } 138 | 139 | @Override 140 | protected void onDraw(Canvas canvas) { 141 | super.onDraw(canvas); 142 | if (_isfristDrawBackGround) { 143 | _Height = getHeight(); 144 | _Width = getWidth(); 145 | } 146 | _EffectiveHeight = _Height - _TopIndent - _BottomIndent; 147 | _EffectiveWidth = _Width - _RightIndent - _LeftIndent; 148 | _XUnitLength = (_EffectiveWidth) / (_PointMaxAmount - 1);// 两条线之间的间距等于宽减出左右缩进除以点�?1 149 | drawBackground(canvas); 150 | drawWave(canvas); 151 | } 152 | 153 | // 画背景图以及格子 154 | public void drawBackground(Canvas canvas) { 155 | if (_isfristDrawBackGround) { 156 | _YSize = (int) (_MaxYNumber / _EveryOneValue);// 垂直格子数量 157 | _LatticeWidth = (int) (_EffectiveHeight / _YSize); 158 | _XSize = (_Width - _RightIndent - _LeftIndent) / _LatticeWidth;// 水平格子数量 159 | float curX = 0; 160 | if (_EveryNPointBold > _YSize || _EveryNPointBold > _XSize) { 161 | _EveryNPointBold = Math.min(_YSize, _XSize) / 2 + 1; 162 | } 163 | for (int i = 0; i < _XSize; i++) { 164 | _ListVLine.add(curX); 165 | curX += _LatticeWidth; 166 | } 167 | float curY = 0; 168 | for (int j = 0; j < _YSize; j++) { 169 | _ListHLine.add(curY); 170 | curY += _LatticeWidth; 171 | } 172 | _isfristDrawBackGround = false; 173 | } 174 | _PaintDataLine.setStrokeWidth(1); 175 | int sText = 5; 176 | for (int i = 0; i < _ListVLine.size(); i++) { 177 | sText = 5 * i; 178 | canvas.drawText(sText + "", _ListVLine.get(i) + _TopIndent, _Height 179 | - _TopIndent + _XYTextSize, _XYTextPaint); 180 | if (i == 0) { 181 | _PaintDataLine.setStrokeWidth(8); 182 | canvas.drawLine(_ListVLine.get(i) + _LeftIndent, 183 | 0 + _TopIndent, _ListVLine.get(i) + _LeftIndent, 184 | _Height - _BottomIndent, _PaintDataLine); 185 | _PaintDataLine.setStrokeWidth(1); 186 | } else { 187 | if (i % _EveryNPointBold == 0) { 188 | _PaintDataLine.setStrokeWidth(3); 189 | canvas.drawLine(_ListVLine.get(i) + _LeftIndent, 190 | 0 + _TopIndent, _ListVLine.get(i) + _LeftIndent, 191 | _Height - _BottomIndent, _PaintDataLine); 192 | _PaintDataLine.setStrokeWidth(1); 193 | } else { 194 | canvas.drawLine(_ListVLine.get(i) + _LeftIndent, 195 | 0 + _TopIndent, _ListVLine.get(i) + _LeftIndent, 196 | _Height - _BottomIndent, _PaintDataLine); 197 | } 198 | } 199 | } 200 | _PaintDataLine.setStrokeWidth(8); 201 | canvas.drawLine(0 + _LeftIndent, _Height - _TopIndent, _Width 202 | - _RightIndent, _Height - _BottomIndent, _PaintDataLine); 203 | _PaintDataLine.setStrokeWidth(1); 204 | String sYText = ""; 205 | for (int i = 0; i < _ListHLine.size(); i++) { 206 | if (i == 0) { 207 | sYText = (int) _EveryOneValue * (_YSize - i) + ""; 208 | canvas.drawText(sYText, _LeftIndent - _XYTextSize * 3, 209 | _ListHLine.get(i) + _TopIndent, _XYTextPaint); 210 | _PaintDataLine.setStrokeWidth(8); 211 | canvas.drawLine(0 + _LeftIndent, 212 | _ListHLine.get(i) + _TopIndent, _Width - _RightIndent, 213 | _ListHLine.get(i) + _BottomIndent, _PaintDataLine); 214 | _PaintDataLine.setStrokeWidth(1); 215 | } else { 216 | if (i % _EveryNPointBold == 0) { 217 | sYText = (int) _EveryOneValue * (_YSize - i) + ""; 218 | canvas.drawText(sYText, _LeftIndent - _XYTextSize * 3, 219 | _ListHLine.get(i) + _TopIndent, _XYTextPaint); 220 | _PaintDataLine.setStrokeWidth(3); 221 | canvas.drawLine(0 + _LeftIndent, _ListHLine.get(i) 222 | + _TopIndent, _Width - _RightIndent, 223 | _ListHLine.get(i) + _BottomIndent, _PaintDataLine); 224 | _PaintDataLine.setStrokeWidth(1); 225 | } else { 226 | canvas.drawLine(0 + _LeftIndent, _ListHLine.get(i) 227 | + _TopIndent, _Width - _RightIndent, 228 | _ListHLine.get(i) + _BottomIndent, _PaintDataLine); 229 | } 230 | } 231 | } 232 | canvas.drawText(title, _Width / 2 - 100, _TopIndent / 2, 233 | _TitleTextPaint); 234 | _PaintDataLine.setStrokeWidth(8); 235 | canvas.drawLine(_Width - _RightIndent, 0 + _TopIndent, _Width 236 | - _RightIndent, _Height - _BottomIndent, _PaintDataLine); 237 | } 238 | 239 | // 画点 240 | public void drawWave(Canvas canvas) { 241 | for (int index = 0; index < _ListPoint.size(); index++) { 242 | if (_ListPoint.size() == _PointMaxAmount 243 | && (index >= _CurP && index < _CurP + _RemovedPointNum)) { 244 | continue; 245 | } 246 | if (index > 0) { 247 | if (_ListPoint.get(index).get(Y_KEY) < 0 248 | || _ListPoint.get(index).get(Y_KEY) < _TopIndent) { 249 | continue; 250 | } 251 | canvas.drawLine(_ListPoint.get(index - 1).get(X_KEY), 252 | _ListPoint.get(index - 1).get(Y_KEY), 253 | _ListPoint.get(index).get(X_KEY), _ListPoint.get(index) 254 | .get(Y_KEY), _PaintLine); 255 | canvas.setDrawFilter(new PaintFlagsDrawFilter(0, 256 | Paint.ANTI_ALIAS_FLAG | Paint.FILTER_BITMAP_FLAG)); 257 | } 258 | } 259 | } 260 | 261 | // 设置 心电图的�? 262 | public void setLinePoint(float curY) { 263 | Map temp = new HashMap(); 264 | temp.put(X_KEY, _CurX); 265 | _CurX += _XUnitLength; 266 | // 计算y真实�?���? 267 | float number = curY / _EveryOneValue;// 这个数应该占的格子数 268 | if (_Height != 0) { 269 | _CurY = _Height - (_BottomIndent + number * _LatticeWidth); 270 | } 271 | if (_CurY < _TopIndent) { 272 | _CurY = _TopIndent + 10; 273 | } 274 | temp.put(Y_KEY, _CurY); 275 | // 判断当前点是否大于最大点�? 276 | if (_CurP < _PointMaxAmount) { 277 | try { 278 | if (_ListPoint.size() == _PointMaxAmount 279 | && _ListPoint.get(_CurP) != null) { 280 | _ListPoint.remove(_CurP); 281 | } 282 | } catch (Exception e) { 283 | e.printStackTrace(); 284 | } 285 | _ListPoint.add(_CurP, temp); 286 | _CurP++; 287 | } else { 288 | _CurP = 0; 289 | _CurX = _RightIndent; 290 | } 291 | if (_CurP % _EveryNPointRefresh == 0) { 292 | invalidate(); 293 | } 294 | if (isSetAlarmFlag) { 295 | if (!(curY > _minAlarmNumber && curY < _maxAlarmNumber)) { 296 | _handler.post(new alarmThread( 297 | curY < _minAlarmNumber ? LOW_ALARM : HIGH_ALARM)); 298 | } 299 | 300 | } 301 | } 302 | 303 | public void setRemovedPointNum(int removedPointNum) { 304 | _RemovedPointNum = removedPointNum; 305 | } 306 | 307 | // 设置每N个点刷新�?�� 308 | public void setEveryNPointRefresh(int num) { 309 | _EveryNPointRefresh = num; 310 | } 311 | 312 | public float getCurrentPointX() { 313 | return _CurX; 314 | } 315 | 316 | public float getCurrentPointY() { 317 | return _CurY; 318 | } 319 | 320 | @Override 321 | protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { 322 | super.onMeasure(widthMeasureSpec, heightMeasureSpec); 323 | } 324 | 325 | // 设置�?��屏幕有多少个�? 326 | public void setMaxPointAmount(int i) { 327 | _PointMaxAmount = i; 328 | } 329 | 330 | // 设置几个格子画一条粗�? 331 | public void setEveryNPoint(int everyNPointBold) { 332 | if (everyNPointBold < 0) { 333 | return; 334 | } 335 | _EveryNPointBold = everyNPointBold; 336 | } 337 | 338 | // 设置Y轴最大�? 339 | public void setMaxYNumber(float maxYNumber) { 340 | this._MaxYNumber = maxYNumber; 341 | } 342 | 343 | // 设置心电图标�? 344 | public void setTitle(String title) { 345 | this.title = title; 346 | } 347 | 348 | // 设置格子的单�? 349 | public void setEffticeValue(int value) { 350 | _EveryOneValue = value; 351 | } 352 | 353 | public void setAlarmMessage(int maxAlarmNumber, int minAlarmNumber, 354 | String lowAlarmMsg, String highAlarmMsg) { 355 | isSetAlarmFlag = true; 356 | _maxAlarmNumber = maxAlarmNumber; 357 | _minAlarmNumber = minAlarmNumber; 358 | _lowAlarmMsg = lowAlarmMsg; 359 | _highAlarmMsg = highAlarmMsg; 360 | } 361 | 362 | class alarmThread implements Runnable { 363 | int _flag; 364 | 365 | alarmThread(int flag) { 366 | _flag = flag; 367 | } 368 | 369 | @Override 370 | public void run() { 371 | Toast.makeText(_context, 372 | _flag == LOW_ALARM ? _lowAlarmMsg : _highAlarmMsg, 373 | Toast.LENGTH_SHORT).show(); 374 | } 375 | 376 | } 377 | 378 | } 379 | --------------------------------------------------------------------------------