}
191
                }
192
            });
193
        }
194
        else
195
        {
196
            ((TemplateWebView) getWebView()).loadTemplate(templatePath, data);
197
        }
198
    }
199

200
    public void openTemplate(String pageAction, Map<?, ?> data)
201
            throws Exception
202
    {
203
        openTemplate(pageAction, data, true);
204
    }
205

206
    /**
207
     * @Title: getTemplate
208
     * @Description: 页面部分刷新,不调用接口
209
     * @author 程文斌
210
     * @param param
211
     * @throws Exception
212
     * @throws
213
     */
214
    public void getTemplate(JSONArray param) throws Exception
215
    {
216
        String pageAction = param.getString(0);
217
        String data = param.getString(1);
218
        boolean isEscape = "true".equals(param.getString(2)) ? true : false;
219
        String html = getTemplate(pageAction, isNull(data) ? null
220
                : new DataMap(data));
221
        if (isEscape)
222
        {
223
            html = EscapeUnescape.escape(html);
224
        }
225
        callback(html);
226
    }
227

228
    /**
229
     * @Title: getTemplate
230
     * @Description: getTemplate具体实现
231
     * @author 程文斌
232
     * @param pageAction
233
     * @param data
234
     * @return
235
     * @throws Exception
236
     * @throws
237
     */
238
    public String getTemplate(String pageAction, Map<String, Object> data) throws Exception
239
    {
240
        /* 获取模板相对路径 */
241
        String templatePath = ServerPageConfig.getTemplate(pageAction);
242
        if (templatePath == null || "".equals(templatePath))
243
        {
244
            Utility.error(Messages.NO_TEMPLATE);
245
        }
246
        return ((TemplateWebView) getWebView()).getTemplate(templatePath, data);
247
    }
248

249
    /**
250
    * @Title: getPage
251
    * @Description: 页面部分刷新,调用接口
252
    * @author 程文斌
253
    * @param param
254
    * @throws Exception
255
    * @throws
256
    */
257
    public void getPage(JSONArray param) throws Exception
258
    {
189 259
        String pageAction = param.getString(0);
190 260
        String data = param.getString(1);
191 261
        boolean isEscape = "true".equals(param.getString(2)) ? true : false;
192
        String html = getPage(pageAction, isNull(data)?null:new DataMap(data));
193
        if (isEscape) {
262
        String html = getPage(pageAction, isNull(data) ? null : new DataMap(
263
                data));
264
        if (isEscape)
265
        {
194 266
            html = EscapeUnescape.escape(html);
195 267
        }
196 268
        callback(html);
197 269
    }
198
	
199
    public String getPage(String pageAction,DataMap param) throws Exception{
200
        /*获取模板相对路径*/
270

271
    /**
272
     * @Title: getPage
273
     * @Description: getPage具体实现
274
     * @author 程文斌
275
     * @param pageAction
276
     * @param param
277
     * @return
278
     * @throws Exception
279
     * @throws
280
     */
281
    public String getPage(String pageAction, DataMap param) throws Exception
282
    {
283
        /* 获取模板相对路径 */
201 284
        String templatePath = ServerPageConfig.getTemplate(pageAction);
202
        if(templatePath==null||"".equals(templatePath)){
285
        if (templatePath == null || "".equals(templatePath))
286
        {
203 287
            Utility.error(Messages.NO_TEMPLATE + ",Action:" + pageAction);
204 288
        }
205
        
289

206 290
        IData data = null;
207
        /*载入业务数据*/
291
        /* 载入业务数据 */
208 292
        String dataAction = ServerPageConfig.getData(pageAction);
209
        if(dataAction!=null){
210
            MobileNetWork MobileNetWork = wademobile.getPluginManager().getPlugin(MobileNetWork.class);
293
        if (dataAction != null)
294
        {
295
            MobileNetWork MobileNetWork = wademobile.getPluginManager()
296
                    .getPlugin(MobileNetWork.class);
211 297
            String result = MobileNetWork.dataRequest(dataAction, param);// 打开页面时请求业务数据
212 298
            data = new DataMap(result);
213
            if(data.getInt("X_RESULTCODE")<0){
299
            if (data.getInt("X_RESULTCODE") < 0)
300
            {
214 301
                error(data.toString());
215 302
                return null;
216 303
            }
217 304
        }
218
        /*String serverDataAction = ServerPageConfig.getData(pageAction);
219
        String className = ServerDataConfig.getActionClass(serverDataAction);
220
        String methodName = ServerDataConfig.getActionMethod(serverDataAction);
221
        // new一个className 调用里面的method 得到resule的dataMap
222
        Class clz = Class.forName(className);
223
        Object obj = clz.newInstance();
224
        //获取方法  
225
        Method m = obj.getClass().getDeclaredMethod(methodName, String.class);
226
        //调用方法  
227
        String result = (String) m.invoke(obj, data);
228
        JSONObject  jasonObject = (JSONObject) JSONObject.stringToValue(result);
229
        Map map = (Map)jasonObject;
230
        if(templatePath==null||"".equals(templatePath)){
231
            Utility.error(Messages.NO_TEMPLATE);
232
        }*/
233
        return ((TemplateWebView)getWebView()).getTemplate(templatePath, data);
234
    }
235
	
236
	/************************多WebView 开始*****************************/
237
	private TemplateWebView initFlipperPage(String pageAction, boolean isAnimation) {
238
		// TODO Auto-generated method stub
239
		FlipperLayout mainFlipper = wademobile.getFlipperLayout();
240
		TemplateWebView webview = (TemplateWebView) mainFlipper.findViewWithTag(pageAction);
241
		if (webview == null) {
242
			webview = addFlipperPage(mainFlipper, pageAction);
243
		}
244
		if(isAnimation){
245
			mainFlipper.setAnimation(AnimationResource.pushLeft[0],AnimationResource.pushLeft[1]);
246
			mainFlipper.setBackAnimation(AnimationResource.pushRight[0],AnimationResource.pushRight[1]);
247
		}
248
		webview.setTag(pageAction);
249
		mainFlipper.setPreCurrView(webview);
250
		return webview;
251
	}
252

253
	private TemplateWebView addFlipperPage(final FlipperLayout mainFlipper, final String pageAction) {
254
		final TemplateWebView webview = new TemplateWebView(wademobile){
255
			final TemplateWebView outWebView = this;//让上级对象转义到下级scope
256
			@Override
257
			protected void initialize() {
258
				// TODO Auto-generated method stub
259
				WadeWebViewClient webViewClient = new WadeWebViewClient(wademobile,new TemplateWebViewEvent(wademobile){
260
					@Override
261
					public void loadingFinished(WebView view, String url) {
262
						// TODO Auto-generated method stub
263
						wademobile.getFlipperLayout().showView(outWebView.getTag().toString());//直接使用getTag()方法也可行
264
					}
265
				});
266
				setWebViewClient(webViewClient);
267
			}
268
		};
269
		webview.setLayoutParams(ConstantParams.getFillParams(LinearLayout.LayoutParams.class));
270
		((WadeMobileActivity) wademobile).getWebviewSetting().setWebViewStyle(webview);//设置webview的样式
271

272
		webview.setId(mainFlipper.getChildCount());
273

274
		mainFlipper.addView(webview);//增加view
275
		webview.postInvalidate();//刷新页面
276
		return webview;
277
	}
278
	
279
	public void back(JSONArray param) throws Exception {
280
		final FlipperLayout mainFlipper = wademobile.getFlipperLayout();
281
		if (mainFlipper != null) {
282
			Runtime runtime = Runtime.getRuntime();
283
			runtime.exec("input keyevent " + KeyEvent.KEYCODE_BACK);
284
			/*context.runOnUiThread(new Runnable() {
285
				public void run() {
286
					mainFlipper.back();
287
				}
288
			});*/
289
		} else {
290
			HintHelper.alert(context, "不支持back方法");
291
		}
292
	}
293
	/************************多WebView 结束*****************************/
294
	
295
	public void alert(JSONArray param) throws Exception {
296
		String title = null;
297
		if(param.length()>1){
298
			title = param.getString(1);
299
		}
300
		
301
		new HintDialog(context, param.getString(0), title){
302
			protected void clickEvent() {
303
				MobileUI.this.callback("1212");
304
			};
305
		}.show();
306
	}
307
	
308
	public void tip(JSONArray param) throws Exception {
309
		int duration = 0;
310
		if(param.length()>1){
311
			duration = param.getInt(1)==0?0:1;
312
		}
313
		HintHelper.tip(context, param.getString(0), duration);
314
	}
315
	
316
	public void loadingStart(JSONArray param) throws Exception {
317
		String message = param.getString(0);
318
		String title  = param.getString(1);
319
		String cancelable  = param.getString(2);
320
		loadingStart(message, title, isNull(cancelable)?true:Boolean.parseBoolean(cancelable));
321
	}
322
	
323
	/**
324
	 * JS loading效果触发
325
	 */
326
	public synchronized void loadingStart(final String message,final String title,final boolean cancelable) {
327
		final String msg = isNull(message) ? Messages.DIALOG_LOADING : message;
328
		Runnable runnable = new Runnable() {
329
			private void clear() {
330
				if (progressDialog != null && progressDialog.getProgressDialog().isShowing()) {
331
					progressDialog.getProgressDialog().dismiss();
332
					progressDialog = null;
333
				}
334
			}
335
			
336
			public void run() {
337
				clear();//防止重复打开等待对话框
338
				MobileUI.progressDialog = new SimpleProgressDialog(MobileUI.this.context);
339
				MobileUI.progressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);//圆形状以及STYLE_HORIZONTAL 条状
340
				if(title!=null&&!title.equals("")&&!title.equals(NULL)){
341
					MobileUI.progressDialog.setTitle(title);
342
				}
343
				MobileUI.progressDialog.setMessage(msg);
344
				MobileUI.progressDialog.setCancelable(cancelable);
345
				MobileUI.progressDialog.setCanceledOnTouchOutside(false);
346
				/*Object obj = cache.get(MobileCache.LOADING_DIALOG_POSITION);
347
				obj = refleck.getStaticProperty("android.view.Gravity", obj.toString());*/
348
				MobileUI.progressDialog.getProgressDialog().getWindow().setGravity(Gravity.CENTER); //居上
349
				MobileUI.progressDialog.getProgressDialog().setOnCancelListener(
350
								new DialogInterface.OnCancelListener() {
351
									public void onCancel(DialogInterface dialog) {
352
										clear();//设置取消按钮的事件,可以让setCancelable(false)也失效
353
									}
354
								});
355
				MobileUI.progressDialog.build().show();
356
			}
357
		};
358
		this.context.runOnUiThread(runnable);
359
	}
360
	
361
	public void loadingStop(JSONArray param) throws Exception {
362
		int count = 0;
363
		while(!loadingStop()){
364
			Thread.sleep(500);
365
			count++;
366
			if(count>3){
367
				break;
368
			}
369
		}
370
	}
371
	
372
	/**
373
	 * JS Loading效果关闭
374
	 */
375
	public boolean loadingStop() {
376
		if (progressDialog != null && progressDialog.getProgressDialog().isShowing()) {
377
			progressDialog.getProgressDialog().dismiss();
378
			progressDialog = null;
379
			return true;
380
		}else{
381
			return false;
382
		}
383
	}
384
	
385
	public void confirm(JSONArray param) throws Exception {
386
		String message = param.getString(0);
387
		String title = param.getString(1);
388
		String[] events = isNull(param.getString(2))?null:param.getString(2).split(Constant.PARAMS_SQE);
389
		String[] buttons = isNull(param.getString(3))?null:param.getString(3).split(Constant.PARAMS_SQE);
390
		confirm(message, title, events, buttons);
391
	}
392
	
393
	/**
394
	 * JS confirm 触发
395
	 * @param message
396
	 * @param title
397
	 * @param events
398
	 * @param buttons
399
	 */
400
	public void confirm(String message,String title,final String[] events,final String[] buttons) {
401
		// TODO Auto-generated method stub
402
		AlertDialog.Builder dialog = new AlertDialog.Builder(this.context);
305
        return ((TemplateWebView) getWebView()).getTemplate(templatePath, data);
306
    }
307

308
    /************************ 多WebView 开始 *****************************/
309
    private TemplateWebView initFlipperPage(String pageAction,
310
            boolean isAnimation)
311
    {
312
        // TODO Auto-generated method stub
313
        FlipperLayout mainFlipper = wademobile.getFlipperLayout();
314
        TemplateWebView webview = (TemplateWebView) mainFlipper
315
                .findViewWithTag(pageAction);
316
        if (webview == null)
317
        {
318
            webview = addFlipperPage(mainFlipper, pageAction);
319
        }
320
        if (isAnimation)
321
        {
322
            mainFlipper.setAnimation(AnimationResource.pushLeft[0],
323
                    AnimationResource.pushLeft[1]);
324
            mainFlipper.setBackAnimation(AnimationResource.pushRight[0],
325
                    AnimationResource.pushRight[1]);
326
        }
327
        webview.setTag(pageAction);
328
        mainFlipper.setPreCurrView(webview);
329
        return webview;
330
    }
331

332
    private TemplateWebView addFlipperPage(final FlipperLayout mainFlipper,
333
            final String pageAction)
334
    {
335
        final TemplateWebView webview = new TemplateWebView(wademobile)
336
        {
337
            final TemplateWebView outWebView = this;// 让上级对象转义到下级scope
338

339
            @Override
340
            protected void initialize()
341
            {
342
                // TODO Auto-generated method stub
343
                WadeWebViewClient webViewClient = new WadeWebViewClient(
344
                        wademobile, new TemplateWebViewEvent(wademobile)
345
                        {
346
                            @Override
347
                            public void loadingFinished(WebView view, String url)
348
                            {
349
                                // TODO Auto-generated method stub
350
                                wademobile.getFlipperLayout().showView(
351
                                        outWebView.getTag().toString());// 直接使用getTag()方法也可行
352
                            }
353
                        });
354
                setWebViewClient(webViewClient);
355
            }
356
        };
357
        webview.setLayoutParams(ConstantParams
358
                .getFillParams(LinearLayout.LayoutParams.class));
359
        ((WadeMobileActivity) wademobile).getWebviewSetting().setWebViewStyle(
360
                webview);// 设置webview的样式
361

362
        webview.setId(mainFlipper.getChildCount());
363

364
        mainFlipper.addView(webview);// 增加view
365
        webview.postInvalidate();// 刷新页面
366
        return webview;
367
    }
368

369
    public void back(JSONArray param) throws Exception
370
    {
371
        final FlipperLayout mainFlipper = wademobile.getFlipperLayout();
372
        if (mainFlipper != null)
373
        {
374
            Runtime runtime = Runtime.getRuntime();
375
            runtime.exec("input keyevent " + KeyEvent.KEYCODE_BACK);
376
            /*
377
             * context.runOnUiThread(new Runnable() { public void run() {
378
             * mainFlipper.back(); } });
379
             */
380
        }
381
        else
382
        {
383
            HintHelper.alert(context, "不支持back方法");
384
        }
385
    }
386

387
    /************************ 多WebView 结束 *****************************/
388

389
    public void alert(JSONArray param) throws Exception
390
    {
391
        String title = null;
392
        if (param.length() > 1)
393
        {
394
            title = param.getString(1);
395
        }
396

397
        new HintDialog(context, param.getString(0), title)
398
        {
399
            protected void clickEvent()
400
            {
401
                MobileUI.this.callback("1212");
402
            };
403
        }.show();
404
    }
405

406
    public void tip(JSONArray param) throws Exception
407
    {
408
        int duration = 0;
409
        if (param.length() > 1)
410
        {
411
            duration = param.getInt(1) == 0 ? 0 : 1;
412
        }
413
        HintHelper.tip(context, param.getString(0), duration);
414
    }
415

416
    public void loadingStart(JSONArray param) throws Exception
417
    {
418
        String message = param.getString(0);
419
        String title = param.getString(1);
420
        String cancelable = param.getString(2);
421
        loadingStart(message, title,
422
                isNull(cancelable) ? true : Boolean.parseBoolean(cancelable));
423
    }
424

425
    /**
426
     * JS loading效果触发
427
     */
428
    public synchronized void loadingStart(final String message,
429
            final String title, final boolean cancelable)
430
    {
431
        final String msg = isNull(message) ? Messages.DIALOG_LOADING : message;
432
        Runnable runnable = new Runnable()
433
        {
434
            private void clear()
435
            {
436
                if (progressDialog != null
437
                        && progressDialog.getProgressDialog().isShowing())
438
                {
439
                    progressDialog.getProgressDialog().dismiss();
440
                    progressDialog = null;
441
                }
442
            }
443

444
            public void run()
445
            {
446
                clear();// 防止重复打开等待对话框
447
                MobileUI.progressDialog = new SimpleProgressDialog(
448
                        MobileUI.this.context);
449
                MobileUI.progressDialog
450
                        .setProgressStyle(ProgressDialog.STYLE_SPINNER);// 圆形状以及STYLE_HORIZONTAL
451
                                                                        // 条状
452
                if (title != null && !title.equals("") && !title.equals(NULL))
453
                {
454
                    MobileUI.progressDialog.setTitle(title);
455
                }
456
                MobileUI.progressDialog.setMessage(msg);
457
                MobileUI.progressDialog.setCancelable(cancelable);
458
                MobileUI.progressDialog.setCanceledOnTouchOutside(false);
459
                /*
460
                 * Object obj = cache.get(MobileCache.LOADING_DIALOG_POSITION);
461
                 * obj = refleck.getStaticProperty("android.view.Gravity",
462
                 * obj.toString());
463
                 */
464
                MobileUI.progressDialog.getProgressDialog().getWindow()
465
                        .setGravity(Gravity.CENTER); // 居上
466
                MobileUI.progressDialog.getProgressDialog()
467
                        .setOnCancelListener(
468
                                new DialogInterface.OnCancelListener()
469
                                {
470
                                    public void onCancel(DialogInterface dialog)
471
                                    {
472
                                        clear();// 设置取消按钮的事件,可以让setCancelable(false)也失效
473
                                    }
474
                                });
475
                MobileUI.progressDialog.build().show();
476
            }
477
        };
478
        this.context.runOnUiThread(runnable);
479
    }
480

481
    public void loadingStop(JSONArray param) throws Exception
482
    {
483
        int count = 0;
484
        while (!loadingStop())
485
        {
486
            Thread.sleep(500);
487
            count++;
488
            if (count > 3)
489
            {
490
                break;
491
            }
492
        }
493
    }
494

495
    /**
496
     * JS Loading效果关闭
497
     */
498
    public boolean loadingStop()
499
    {
500
        if (progressDialog != null
501
                && progressDialog.getProgressDialog().isShowing())
502
        {
503
            progressDialog.getProgressDialog().dismiss();
504
            progressDialog = null;
505
            return true;
506
        }
507
        else
508
        {
509
            return false;
510
        }
511
    }
512

513
    public void confirm(JSONArray param) throws Exception
514
    {
515
        String message = param.getString(0);
516
        String title = param.getString(1);
517
        String[] events = isNull(param.getString(2)) ? null : param
518
                .getString(2).split(Constant.PARAMS_SQE);
519
        String[] buttons = isNull(param.getString(3)) ? null : param.getString(
520
                3).split(Constant.PARAMS_SQE);
521
        confirm(message, title, events, buttons);
522
    }
523

524
    /**
525
     * JS confirm 触发
526
     * 
527
     * @param message
528
     * @param title
529
     * @param events
530
     * @param buttons
531
     */
532
    public void confirm(String message, String title, final String[] events,
533
            final String[] buttons)
534
    {
535
        // TODO Auto-generated method stub
536
        AlertDialog.Builder dialog = new AlertDialog.Builder(this.context);
403 537
        dialog.setMessage(message);
404
        if(title!=null){
405
        	dialog.setTitle(title);
538
        if (title != null)
539
        {
540
            dialog.setTitle(title);
406 541
        }
407 542
        dialog.setCancelable(false);
408
        if(buttons==null||buttons[0]==null){
409
        	dialog.setPositiveButton(android.R.string.ok,
410
                	new DialogInterface.OnClickListener() {
411
                    	public void onClick(DialogInterface dialog, int which) {
412
                    		if(events!=null&&events[0]!=null){
413
                    			MobileUI.this.executeJs(events[0]);
414
                    		}
543
        if (buttons == null || buttons[0] == null)
544
        {
545
            dialog.setPositiveButton(android.R.string.ok,
546
                    new DialogInterface.OnClickListener()
547
                    {
548
                        public void onClick(DialogInterface dialog, int which)
549
                        {
550
                            if (events != null && events[0] != null)
551
                            {
552
                                MobileUI.this.executeJs(events[0]);
553
                            }
415 554
                        }
416 555
                    });
417
        }else{
418
        	dialog.setPositiveButton(buttons[0],//android.R.string.ok 
419
                	new DialogInterface.OnClickListener() {
420
                    	public void onClick(DialogInterface dialog, int which) {
421
                    		if(events!=null&&events[0]!=null){
422
                    			MobileUI.this.executeJs(events[0]);
423
                    		}
556
        }
557
        else
558
        {
559
            dialog.setPositiveButton(buttons[0],// android.R.string.ok
560
                    new DialogInterface.OnClickListener()
561
                    {
562
                        public void onClick(DialogInterface dialog, int which)
563
                        {
564
                            if (events != null && events[0] != null)
565
                            {
566
                                MobileUI.this.executeJs(events[0]);
567
                            }
424 568
                        }
425 569
                    });
426 570
        }
427
        
428
        if(buttons==null||buttons[1]==null){
429
        	dialog.setNegativeButton(android.R.string.cancel,
430
                	new DialogInterface.OnClickListener() {
431
                    	public void onClick(DialogInterface dialog, int which) {
432
                    		if(events!=null&&events[1]!=null){
433
                    			MobileUI.this.executeJs(events[1]);
434
                    		}
571

572
        if (buttons == null || buttons[1] == null)
573
        {
574
            dialog.setNegativeButton(android.R.string.cancel,
575
                    new DialogInterface.OnClickListener()
576
                    {
577
                        public void onClick(DialogInterface dialog, int which)
578
                        {
579
                            if (events != null && events[1] != null)
580
                            {
581
                                MobileUI.this.executeJs(events[1]);
582
                            }
435 583
                        }
436 584
                    });
437
        }else{
438
        	dialog.setNegativeButton(buttons[1],//android.R.string.cancel
439
                	new DialogInterface.OnClickListener() {
440
                    	public void onClick(DialogInterface dialog, int which) {
441
                    		if(events!=null&&events[1]!=null){
442
                    			MobileUI.this.executeJs(events[1]);
443
                    		}
585
        }
586
        else
587
        {
588
            dialog.setNegativeButton(buttons[1],// android.R.string.cancel
589
                    new DialogInterface.OnClickListener()
590
                    {
591
                        public void onClick(DialogInterface dialog, int which)
592
                        {
593
                            if (events != null && events[1] != null)
594
                            {
595
                                MobileUI.this.executeJs(events[1]);
596
                            }
444 597
                        }
445 598
                    });
446 599
        }
447 600
        dialog.show();
448
	}
449
	
450
	public void getDate(JSONArray param) throws Exception {
451
		final String date = param.getString(0);
452
		final String format = param.getString(1);
453
		Runnable runnable = new Runnable() {
454
			public void run() {
455
				MobileUI.this.getDate(date, format);
456
			}
457
		};
458
		this.context.runOnUiThread(runnable);
459
	}
460
	
461
	public void getDate(String date,final String format) {
462
		// TODO Auto-generated method stub
463
		int year,month,day_of_month;
464
		final Calendar cal = Calendar.getInstance();
465
		final SimpleDateFormat df = new SimpleDateFormat(format);
466
		if(date!=null&&!date.equals(NULL)&&!date.equals("")){
467
			try {
468
				Date d = df.parse(date);
469
				cal.setTime(d);
470
			} catch (ParseException e) {
471
				cal.setTime(new Date());
472
			}
473
		}else{
474
			cal.setTime(new Date());
475
		}
476
		year = cal.get(Calendar.YEAR);
477
		month = cal.get(Calendar.MONTH);
478
		day_of_month = cal.get(Calendar.DAY_OF_MONTH);
479
		
480
		if(format.endsWith("MM")){
481
			final YMPickerDialog datePickerDialog = new YMPickerDialog(context,
482
					new DatePickerDialog.OnDateSetListener() {
483
						@Override
484
						public void onDateSet(DatePicker view, int year,
485
								int monthOfYear, int dayOfMonth) {
486
							// TODO Auto-generated method stub
487
							cal.set(year, monthOfYear, dayOfMonth);
488
							String date = df.format(cal.getTime());
489
							MobileUI.this.callback(date);
490
						}
491

492
					}, year,// 传入年份
493
					month,// 传入月份
494
					day_of_month,// 传入天数
495
					df
496
			);
497
			datePickerDialog.show();
498
		}else{
499
			final DatePickerDialog datePickerDialog = new DatePickerDialog(context,
500
					new DatePickerDialog.OnDateSetListener() {
501
						@Override
502
						public void onDateSet(DatePicker view, int year,
503
								int monthOfYear, int dayOfMonth) {
504
							// TODO Auto-generated method stub
505
							cal.set(year, monthOfYear, dayOfMonth);
506
							String date = df.format(cal.getTime());
507
							MobileUI.this.callback(date);
508
						}
509

510
					}, year,// 传入年份
511
					month,// 传入月份
512
					day_of_month// 传入天数
513
			);
514
			datePickerDialog.show();
515
		}
516
	}
517
	
518
	public void getContactsView(JSONArray params)throws Exception{
519
	    String dataString1 = params.getString(0);
520
        IDataset list1 = null;
521
        if(StringUtil.isDataMap(dataString1)){
522
            list1 = new DatasetList(new DataMap(dataString1));
523
        }else{
524
            list1 = new DatasetList(dataString1);
525
        }
526
        String dataString2 = params.getString(1);
527
        IDataset list2 = null;
528
        if(StringUtil.isDataMap(dataString2)){
529
            list2 = new DatasetList(new DataMap(dataString2));
530
        }else{
531
            list2 = new DatasetList(dataString1);
532
        }
533
		ContactsData contactsData =new ContactsData();
534
		IData data = null;
535
		for(int id = 0; id < list1.size() ; id++ ){
536
		    data = new DataMap();
537
		    data = list1.getData(id);
538
			contactsData.addNoneTypeRecord(id, data.getString("VALUE"));
539
		}
540
		for(int id = 0; id <list2.size() ; id++ ){
541
		    data = new DataMap();
542
		    data = list2.getData(id);
543
            contactsData.addRecord(id, data.getString("VALUE"));
544
		}
545
		Intent intent = new Intent();
546
		intent.setClass(context, ContactsActivity.class);
547
		intent.putExtra(ContactsConstant.KEY_CONTACTS_DATA, contactsData);
548
		ContactsSettings settings = new ContactsSettings();
549
		intent.putExtra(ContactsConstant.KEY_CONTACTS_SETTINGS, settings);
550
		startActivityForResult(intent, REQUEST_CODE_CONTACTS_VIEW);
551
	}
552
	
553
	public void getChoice(JSONArray param) throws Exception {
554
		final String[] options = isNull(param.getString(0))?null:param.getString(0).split(Constant.PARAMS_SQE);
555
		final String[] values = isNull(param.getString(1))?null:param.getString(1).split(Constant.PARAMS_SQE);
556
		final String title = param.getString(2);
557
		final String iconName = param.getString(3);
558
		final int iconId = isNull(iconName)?android.R.drawable.ic_dialog_info:UiTool.getR(context, Constant.DRAWABLE, iconName);
559
		Runnable runnable = new Runnable() {
560
			public void run() {
561
				MobileUI.this.getChoice(options,values,title,iconId);
562
			}
563
		};
564
		this.context.runOnUiThread(runnable);
565
	}
566
	
567
	public void getChoice(final String options[],final String values[],final String title,final int iconId) {
568
		if(options==null){
569
			return;
570
		}
571
		
572
		Builder choiceDialog = new AlertDialog.Builder(this.context);
573
		if(title!=null&&!title.equals(NULL)){
574
			choiceDialog.setTitle(title)  ;
575
			choiceDialog.setIcon(iconId);
576
		}
577
		
578
		choiceDialog.setSingleChoiceItems(options, 0, new DialogInterface.OnClickListener(){
579
			@Override
580
			public void onClick(DialogInterface dialog, int which) {
581
				if(values!=null&& which < values.length-1){
582
					MobileUI.this.callback(values[which]);
583
				}else{
584
					MobileUI.this.callback(String.valueOf(which));
585
				}
586
				dialog.dismiss();
587
			}
588
		});
589
		choiceDialog.show();
590
	}
591
	
592
	/**
593
	 * 打开对话框
594
	 */
595
	public void openDialog(JSONArray param) throws Exception {
596
		String pageAction = param.getString(0);
597
		String data = param.getString(1);
598
		double width = isNull(param.getString(2))?0.5:param.getDouble(2);
599
		double height = isNull(param.getString(3))?0.5:param.getDouble(3);
600
		this.isEscape = Boolean.parseBoolean(param.getString(4));
601
		
602
		Intent intent = new Intent(context, CustomDialogActivity.class);
603
		intent.putExtra(CustomDialogActivity.KEY_PAGE_ACTION, pageAction);
604
		intent.putExtra(CustomDialogActivity.KEY_DATA, data);
605
		intent.putExtra(CustomDialogActivity.KEY_WIDTH, width);
606
		intent.putExtra(CustomDialogActivity.KEY_HEIGHT, height);
607
		startActivityForResult(intent, REQUEST_CODE_CUSTOM_DIALOG);
608
	}
609

610
	/**
611
	 * 关闭对话框
612
	 */
613
	public void closeDialog(JSONArray param) throws Exception {
614
		String resultData = param.getString(0);
615
		resultData = isNull(resultData) ? null : resultData;
616
		int resultState = isNull(param.getString(1))?CustomDialogActivity.SUCCESS_CODE:param.getInt(1);
617
		if(context instanceof CustomDialogActivity){
618
			((CustomDialogActivity) context).closeDialog(resultData, resultState);
619
		}else{
620
			HintHelper.alert(context, "无对话框可以关闭!");
621
		}
622
	}
623
	
624
	/**
625
	 * 打开窗口
626
	 */
627
	public void openWindow(JSONArray param) throws Exception {
628
		String pageAction = param.getString(0);
629
		String data = param.getString(1);
630
		this.isEscape = Boolean.parseBoolean(param.getString(2));
631
		
632
		Intent intent = new Intent(context, CustomWindowActivity.class);
633
		intent.putExtra(CustomWindowActivity.KEY_PAGE_ACTION, pageAction);
634
		intent.putExtra(CustomWindowActivity.KEY_DATA, data);
635
		startActivityForResult(intent, REQUEST_CODE_CUSTOM_WINDOW);
636
	}
637

638
	/**
639
	 * 关闭窗口
640
	 */
641
	public void closeWindow(JSONArray param) throws Exception {
642
		String resultData = param.getString(0);
643
		resultData = isNull(resultData) ? null : resultData;
644
		int resultState = isNull(param.getString(1))?CustomWindowActivity.SUCCESS_CODE:param.getInt(1);
645
		if(context instanceof CustomWindowActivity){
646
			((CustomWindowActivity) context).closeWindow(resultData, resultState);
647
		}else{
648
			HintHelper.alert(context, "无窗口可以关闭!");
649
		}
650
	}
651
	
652
	/**
653
	 * 打开侧滑菜单
654
	 */
655
	public void openSlidingMenu(JSONArray param) throws Exception {
656
		String pageAction = param.getString(0);
657
		String data = param.getString(1);
658
		String width = param.getString(2);
659
		String height = param.getString(3);
660
		String leftMargin = param.getString(4);
661
		String topMargin = param.getString(5);
662
		this.isEscape = Boolean.parseBoolean(param.getString(6));
663
		
664
		Intent intent = new Intent(context, SlidingMenuActivity.class);
665
		intent.putExtra(SlidingMenuActivity.KEY_PAGE_ACTION, pageAction);
666
		intent.putExtra(SlidingMenuActivity.KEY_DATA, data);
667
		intent.putExtra(SlidingMenuActivity.KEY_WIDTH, width);
668
		intent.putExtra(SlidingMenuActivity.KEY_HEIGHT, height);
669
		intent.putExtra(SlidingMenuActivity.KEY_LEFT_MARGIN, leftMargin);
670
		intent.putExtra(SlidingMenuActivity.KEY_TOP_MARGIN, topMargin);
671
		startActivityForResult(intent, REQUEST_CODE_SLIDING_MENU);
672
	}
673
	
674
	/**
675
	 * 关闭侧滑菜单
676
	 */
677
	public void closeSlidingMenu(JSONArray param) throws Exception {
678
		String resultData = param.getString(0);
679
		resultData = isNull(resultData) ? null : resultData;
680
		int resultState = isNull(param.getString(1))?SlidingMenuActivity.SUCCESS_CODE:param.getInt(1);
681
		if(context instanceof SlidingMenuActivity){
682
			((SlidingMenuActivity) context).closeSlidingMenu(resultData, resultState);
683
		}else{
684
			HintHelper.alert(context, "无侧滑菜单可以关闭!");
685
		}
686
	}
687
	
688
	@Override
689
	public void onActivityResult(int requestCode, int resultCode, Intent intent) {
690
		// TODO Auto-generated method stub
691
		if (requestCode == REQUEST_CODE_CUSTOM_DIALOG) {
692
			if(intent==null)
693
				return;
694
			String resultData = intent.getStringExtra(CustomDialogActivity.KEY_RESULT);
695
			if(resultData!=null){
696
				//特殊字符转义
697
				if(this.isEscape){
698
					resultData = EscapeUnescape.escape(resultData);
699
				}
700
				callback(resultData);
701
			}
702
		}else if(requestCode == REQUEST_CODE_CUSTOM_WINDOW){
703
			if(intent==null)
704
				return;
705
			String resultData = intent.getStringExtra(CustomWindowActivity.KEY_RESULT);
706
			if(resultData!=null){
707
				//特殊字符转义
708
				if(this.isEscape){
709
					resultData = EscapeUnescape.escape(resultData);
710
				}
711
				callback(resultData);
712
			}
713
		}else if(requestCode == REQUEST_CODE_SLIDING_MENU){
714
			if(intent==null)
715
				return;
716
			String resultData = intent.getStringExtra(SlidingMenuActivity.KEY_RESULT);
717
			if(resultData!=null&& which < values.length - 1){
718
				//特殊字符转义
719
				if(this.isEscape){
720
					resultData = EscapeUnescape.escape(resultData);
721
				}
722
				callback(resultData);
723
			}
724
		}else if(requestCode == REQUEST_CODE_CONTACTS_VIEW){
725
			ContactsRecord record = intent.getParcelableExtra(ContactsConstant.KEY_SELECT_RECORD);
726
			IData data = new DataMap();
727
			data.put("ID", record.getId());
728
			data.put("TYPE", record.getType());
729
			data.put("VALUE", record.getValue());
730
			data.put("COLOR", record.getColor());
731
			callback(data.toString());
732
		}
733
	}
601
    }
602

603
    public void getDate(JSONArray param) throws Exception
604
    {
605
        final String date = param.getString(0);
606
        final String format = param.getString(1);
607
        Runnable runnable = new Runnable()
608
        {
609
            public void run()
610
            {
611
                MobileUI.this.getDate(date, format);
612
            }
613
        };
614
        this.context.runOnUiThread(runnable);
615
    }
616

617
    public void getDate(String date, final String format)
618
    {
619
        // TODO Auto-generated method stub
620
        int year, month, day_of_month;
621
        final Calendar cal = Calendar.getInstance();
622
        final SimpleDateFormat df = new SimpleDateFormat(format);
623
        if (date != null && !date.equals(NULL) && !date.equals(""))
624
        {
625
            try
626
            {
627
                Date d = df.parse(date);
628
                cal.setTime(d);
629
            }
630
            catch (ParseException e)
631
            {
632
                cal.setTime(new Date());
633
            }
634
        }
635
        else
636
        {
637
            cal.setTime(new Date());
638
        }
639
        year = cal.get(Calendar.YEAR);
640
        month = cal.get(Calendar.MONTH);
641
        day_of_month = cal.get(Calendar.DAY_OF_MONTH);
642

643
        if (format.endsWith("MM"))
644
        {
645
            final YMPickerDialog datePickerDialog = new YMPickerDialog(context,
646
                    new DatePickerDialog.OnDateSetListener()
647
                    {
648
                        @Override
649
                        public void onDateSet(DatePicker view, int year,
650
                                int monthOfYear, int dayOfMonth)
651
                        {
652
                            // TODO Auto-generated method stub
653
                            cal.set(year, monthOfYear, dayOfMonth);
654
                            String date = df.format(cal.getTime());
655
                            MobileUI.this.callback(date);
656
                        }
657

658
                    }, year,// 传入年份
659
                    month,// 传入月份
660
                    day_of_month,// 传入天数
661
                    df);
662
            datePickerDialog.show();
663
        }
664
        else
665
        {
666
            final DatePickerDialog datePickerDialog = new DatePickerDialog(
667
                    context, new DatePickerDialog.OnDateSetListener()
668
                    {
669
                        @Override
670
                        public void onDateSet(DatePicker view, int year,
671
                                int monthOfYear, int dayOfMonth)
672
                        {
673
                            // TODO Auto-generated method stub
674
                            cal.set(year, monthOfYear, dayOfMonth);
675
                            String date = df.format(cal.getTime());
676
                            MobileUI.this.callback(date);
677
                        }
678

679
                    }, year,// 传入年份
680
                    month,// 传入月份
681
                    day_of_month// 传入天数
682
            );
683
            datePickerDialog.show();
684
        }
685
    }
686

687
    /**
688
     * @Title: getContactsView
689
     * @Description: 垂直列表展示
690
     * @author 程文斌
691
     * @param params
692
     * @throws Exception
693
     * @throws
694
     */
695
    public void getContactsView(JSONArray params) throws Exception
696
    {
697
        Intent intent = new Intent();
698
        intent.setClass(context, ContactsActivity.class);
699
        // 第一个参数,data
700
        String dataStr = params.getString(0);
701
        IData dataMap = new DataMap(dataStr);
702
        ContactsData contactsData = new ContactsData();
703
        boolean hasCustomeID = dataMap
704
                .getBoolean(ContactsConstant.KEY_HAS_CUSTOME_ID);
705
        IDataset noneTypeRecordList = dataMap
706
                .getDataset(ContactsConstant.KEY_NONE_TYPE_RECORD_LIST);
707
        this.addNoneTypeRecord(contactsData, noneTypeRecordList, hasCustomeID);
708
        IDataset recordList = dataMap
709
                .getDataset(ContactsConstant.KEY_RECORD_LIST);
710
        this.addRecord(contactsData, recordList, hasCustomeID);
711
        String noneTypeText = dataMap
712
                .getString(ContactsConstant.KEY_NONE_TYPE_TEXT);
713
        contactsData.setNoneTypeText(noneTypeText);
714
        intent.putExtra(ContactsConstant.KEY_CONTACTS_DATA, contactsData);
715

716
        // 第二个参数,setting
717
        String settingStr = params.getString(1);
718
        IData settingMap = new DataMap(settingStr);
719
        ContactsSettings settings = new ContactsSettings();
720
        // 左侧图片是否显示
721
        settings.getChildViewSettings().setWithImage(
722
                settingMap.getBoolean(ContactsConstant.KEY_WITH_IMAGE));
723
        if (!settingMap.getBoolean(ContactsConstant.KEY_WITH_IMAGE))
724
        {
725
            settings.getChildViewSettings().setTextMarginLeft(30);
726
        }
727
        // 每一条记录的字体颜色
728
        settings.getChildViewSettings().setTextColor(
729
                Color.parseColor(settingMap
730
                        .getString(ContactsConstant.KEY_CHILD_TEXT_COLOR)));
731
        // 每一条记录的背景色
732
        settings.getChildViewSettings()
733
                .setChildViewNormalBgColor(
734
                        Color.parseColor(settingMap
735
                                .getString(ContactsConstant.KEY_CHILD_VIEW_NORMAL_BG_COLOR)));
736
        // 每一组的字体颜色,例如:D、E、F
737
        settings.getGroupViewSettings().setGroupViewbgColor(
738
                Color.parseColor(settingMap
739
                        .getString(ContactsConstant.KEY_GROUP_TEXT_COLOR)));
740
        // 每一组的颜色的背景色
741
        settings.getGroupViewSettings().setGroupViewbgColor(
742
                Color.parseColor(settingMap
743
                        .getString(ContactsConstant.KEY_GROUP_VIEW_BG_COLOR)));
744
        // 每条记录之间的分隔线的颜色
745
        settings.getChildViewSettings().setDividerColor(
746
                Color.parseColor(settingMap
747
                        .getString(ContactsConstant.KEY_DIVIDER_COLOR)));
748
        intent.putExtra(ContactsConstant.KEY_CONTACTS_SETTINGS, settings);
749

750
        startActivityForResult(intent, REQUEST_CODE_CONTACTS_VIEW);
751
    }
752

753
    /**
754
     * @Title: addRecord
755
     * @Description: contactsData增加有类型的list数据
756
     * @author 程文斌
757
     * @param contactsData
758
     * @param recordList
759
     * @param hasCustomeID
760
     * @throws
761
     */
762
    private void addRecord(ContactsData contactsData, IDataset recordList,
763
            boolean hasCustomeID)
764
    {
765
        if (recordList != null && !recordList.isEmpty())
766
        {
767
            IData data = null;
768
            int id = 0;
769
            String value = null;
770
            for (int i = 0; i < recordList.size(); i++)
771
            {
772
                data = new DataMap();
773
                data = recordList.getData(i);
774
                if (hasCustomeID && data.getString("ID") != null)
775
                {
776
                    id = Integer.parseInt(data.getString("ID"));
777
                }
778
                else
779
                {
780
                    id = i + 1;
781
                }
782
                if (data.getString("VALUE") != null)
783
                {
784
                    value = data.getString("VALUE");
785
                }
786
                contactsData.addRecord(id, value);
787
            }
788
        }
789
    }
790

791
    /**
792
     * @Title: addNoneTypeRecord
793
     * @Description: contactsData增加有类型的list数据
794
     * @author 程文斌
795
     * @param contactsData
796
     * @param noneTypeRecordList
797
     * @param hasCustomeID
798
     * @throws
799
     */
800
    private void addNoneTypeRecord(ContactsData contactsData,
801
            IDataset noneTypeRecordList, boolean hasCustomeID)
802
    {
803
        if (noneTypeRecordList != null && !noneTypeRecordList.isEmpty())
804
        {
805
            IData data = null;
806
            int id = 0;
807
            String value = null;
808
            for (int i = 0; i < noneTypeRecordList.size(); i++)
809
            {
810
                data = new DataMap();
811
                data = noneTypeRecordList.getData(i);
812
                if (hasCustomeID && data.getString("ID") != null)
813
                {
814
                    id = Integer.parseInt(data.getString("ID"));
815
                }
816
                else
817
                {
818
                    id = i + 1;
819
                }
820
                if (data.getString("VALUE") != null)
821
                {
822
                    value = data.getString("VALUE");
823
                }
824
                contactsData.addNoneTypeRecord(id, value);
825
            }
826
        }
827
    }
828

829
    public void getChoice(JSONArray param) throws Exception
830
    {
831
        final String[] options = isNull(param.getString(0)) ? null : param
832
                .getString(0).split(Constant.PARAMS_SQE);
833
        final String[] values = isNull(param.getString(1)) ? null : param
834
                .getString(1).split(Constant.PARAMS_SQE);
835
        final String title = param.getString(2);
836
        final String iconName = param.getString(3);
837
        final int iconId = isNull(iconName) ? android.R.drawable.ic_dialog_info
838
                : UiTool.getR(context, Constant.DRAWABLE, iconName);
839
        Runnable runnable = new Runnable()
840
        {
841
            public void run()
842
            {
843
                MobileUI.this.getChoice(options, values, title, iconId);
844
            }
845
        };
846
        this.context.runOnUiThread(runnable);
847
    }
848

849
    public void getChoice(final String options[], final String values[],
850
            final String title, final int iconId)
851
    {
852
        if (options == null)
853
        {
854
            return;
855
        }
856

857
        Builder choiceDialog = new AlertDialog.Builder(this.context);
858
        if (title != null && !title.equals(NULL))
859
        {
860
            choiceDialog.setTitle(title);
861
            choiceDialog.setIcon(iconId);
862
        }
863

864
        choiceDialog.setSingleChoiceItems(options, 0,
865
                new DialogInterface.OnClickListener()
866
                {
867
                    @Override
868
                    public void onClick(DialogInterface dialog, int which)
869
                    {
870
                        if (values != null && which < values.length - 1&& which < values.length - 1)
871
                        {
872
                            MobileUI.this.callback(values[which]);
873
                        }
874
                        else
875
                        {
876
                            MobileUI.this.callback(String.valueOf(which));
877
                        }
878
                        dialog.dismiss();
879
                    }
880
                });
881
        choiceDialog.show();
882
    }
883

884
    /**
885
     * 打开对话框
886
     */
887
    public void openDialog(JSONArray param) throws Exception
888
    {
889
        String pageAction = param.getString(0);
890
        String data = param.getString(1);
891
        double width = isNull(param.getString(2)) ? 0.5 : param.getDouble(2);
892
        double height = isNull(param.getString(3)) ? 0.5 : param.getDouble(3);
893
        this.isEscape = Boolean.parseBoolean(param.getString(4));
894

895
        Intent intent = new Intent(context, CustomDialogActivity.class);
896
        intent.putExtra(CustomDialogActivity.KEY_PAGE_ACTION, pageAction);
897
        intent.putExtra(CustomDialogActivity.KEY_DATA, data);
898
        intent.putExtra(CustomDialogActivity.KEY_WIDTH, width);
899
        intent.putExtra(CustomDialogActivity.KEY_HEIGHT, height);
900
        startActivityForResult(intent, REQUEST_CODE_CUSTOM_DIALOG);
901
    }
902

903
    /**
904
     * 关闭对话框
905
     */
906
    public void closeDialog(JSONArray param) throws Exception
907
    {
908
        String resultData = param.getString(0);
909
        resultData = isNull(resultData) ? null : resultData;
910
        int resultState = isNull(param.getString(1)) ? CustomDialogActivity.SUCCESS_CODE
911
                : param.getInt(1);
912
        if (context instanceof CustomDialogActivity)
913
        {
914
            ((CustomDialogActivity) context).closeDialog(resultData,
915
                    resultState);
916
        }
917
        else
918
        {
919
            HintHelper.alert(context, "无对话框可以关闭!");
920
        }
921
    }
922

923
    /**
924
     * 打开窗口
925
     */
926
    public void openWindow(JSONArray param) throws Exception
927
    {
928
        String pageAction = param.getString(0);
929
        String data = param.getString(1);
930
        this.isEscape = Boolean.parseBoolean(param.getString(2));
931

932
        Intent intent = new Intent(context, CustomWindowActivity.class);
933
        intent.putExtra(CustomWindowActivity.KEY_PAGE_ACTION, pageAction);
934
        intent.putExtra(CustomWindowActivity.KEY_DATA, data);
935
        startActivityForResult(intent, REQUEST_CODE_CUSTOM_WINDOW);
936
    }
937

938
    /**
939
     * 关闭窗口
940
     */
941
    public void closeWindow(JSONArray param) throws Exception
942
    {
943
        String resultData = param.getString(0);
944
        resultData = isNull(resultData) ? null : resultData;
945
        int resultState = isNull(param.getString(1)) ? CustomWindowActivity.SUCCESS_CODE
946
                : param.getInt(1);
947
        if (context instanceof CustomWindowActivity)
948
        {
949
            ((CustomWindowActivity) context).closeWindow(resultData,
950
                    resultState);
951
        }
952
        else
953
        {
954
            HintHelper.alert(context, "无窗口可以关闭!");
955
        }
956
    }
957

958
    /**
959
     * 打开侧滑菜单
960
     */
961
    public void openSlidingMenu(JSONArray param) throws Exception
962
    {
963
        String pageAction = param.getString(0);
964
        String data = param.getString(1);
965
        String width = param.getString(2);
966
        String height = param.getString(3);
967
        String leftMargin = param.getString(4);
968
        String topMargin = param.getString(5);
969
        this.isEscape = Boolean.parseBoolean(param.getString(6));
970

971
        Intent intent = new Intent(context, SlidingMenuActivity.class);
972
        intent.putExtra(SlidingMenuActivity.KEY_PAGE_ACTION, pageAction);
973
        intent.putExtra(SlidingMenuActivity.KEY_DATA, data);
974
        intent.putExtra(SlidingMenuActivity.KEY_WIDTH, width);
975
        intent.putExtra(SlidingMenuActivity.KEY_HEIGHT, height);
976
        intent.putExtra(SlidingMenuActivity.KEY_LEFT_MARGIN, leftMargin);
977
        intent.putExtra(SlidingMenuActivity.KEY_TOP_MARGIN, topMargin);
978
        startActivityForResult(intent, REQUEST_CODE_SLIDING_MENU);
979
    }
980

981
    /**
982
     * 关闭侧滑菜单
983
     */
984
    public void closeSlidingMenu(JSONArray param) throws Exception
985
    {
986
        String resultData = param.getString(0);
987
        resultData = isNull(resultData) ? null : resultData;
988
        int resultState = isNull(param.getString(1)) ? SlidingMenuActivity.SUCCESS_CODE
989
                : param.getInt(1);
990
        if (context instanceof SlidingMenuActivity)
991
        {
992
            ((SlidingMenuActivity) context).closeSlidingMenu(resultData,
993
                    resultState);
994
        }
995
        else
996
        {
997
            HintHelper.alert(context, "无侧滑菜单可以关闭!");
998
        }
999
    }
1000

1001
    @Override
1002
    public void onActivityResult(int requestCode, int resultCode, Intent intent)
1003
    {
1004
        // TODO Auto-generated method stub
1005
        if (requestCode == REQUEST_CODE_CUSTOM_DIALOG)
1006
        {
1007
            if (intent == null)
1008
                return;
1009
            String resultData = intent
1010
                    .getStringExtra(CustomDialogActivity.KEY_RESULT);
1011
            if (resultData != null)
1012
            {
1013
                // 特殊字符转义
1014
                if (this.isEscape)
1015
                {
1016
                    resultData = EscapeUnescape.escape(resultData);
1017
                }
1018
                callback(resultData);
1019
            }
1020
        }
1021
        else if (requestCode == REQUEST_CODE_CUSTOM_WINDOW)
1022
        {
1023
            if (intent == null)
1024
                return;
1025
            String resultData = intent
1026
                    .getStringExtra(CustomWindowActivity.KEY_RESULT);
1027
            if (resultData != null)
1028
            {
1029
                // 特殊字符转义
1030
                if (this.isEscape)
1031
                {
1032
                    resultData = EscapeUnescape.escape(resultData);
1033
                }
1034
                callback(resultData);
1035
            }
1036
        }
1037
        else if (requestCode == REQUEST_CODE_SLIDING_MENU)
1038
        {
1039
            if (intent == null)
1040
                return;
1041
            String resultData = intent
1042
                    .getStringExtra(SlidingMenuActivity.KEY_RESULT);
1043
            if (resultData != null)
1044
            {
1045
                // 特殊字符转义
1046
                if (this.isEscape)
1047
                {
1048
                    resultData = EscapeUnescape.escape(resultData);
1049
                }
1050
                callback(resultData);
1051
            }
1052
        }
1053
        else if (requestCode == REQUEST_CODE_CONTACTS_VIEW)
1054
        {
1055
            if (intent == null)
1056
            {
1057
                return;
1058
            }
1059
            ContactsRecord record = intent
1060
                    .getParcelableExtra(ContactsConstant.KEY_SELECT_RECORD);
1061
            IData data = new DataMap();
1062
            data.put("ID", record.getId());
1063
            data.put("TYPE", record.getType());
1064
            data.put("VALUE", record.getValue());
1065
            data.put("COLOR", record.getColor());
1066
            callback(data.toString());
1067
        }
1068
    }
734 1069
}

+ 2 - 1
wade-mobile-func/更新纪要

@ -8,4 +8,5 @@
8 8
更新人:阳彪
9 9
更新时间:2015.4.17 上午
10 10
更新文件:MobileNetWork - dataRequest | DefaultExceptionHandler - dataError
11
更新备注:无
11
更新备注:无
12


【提交内容】:更新jar · e660738bec - Nuosi Git Service
Browse Source

【提交内容】:更新jar

wangyj18 9 years ago
parent
commit
e660738bec

BIN
wade-mobile-common/libs/wade-mobile-func.jar


BIN
wade-mobile-common/libs/wade-mobile.jar


BIN
wade-mobile-library/common/wade-mobile-server.jar