/** @Method: showTopWindow @Description: 显示最顶层view */ public void showTopWindow(Activity c) { this.a = c; View views = null; if (PadUtils.isPad(this)) { views = LayoutInflater.from(this).inflate(R.layout.pad_splash_screen, null); } else { views = LayoutInflater.from(this).inflate(R.layout.phone_splash_screen, null); } WindowManager windowManager = (WindowManager) getApplicationContext().getSystemService(WINDOW_SERVICE); WindowManager.LayoutParams params = new WindowManager.LayoutParams(); params.type = WindowManager.LayoutParams.TYPE_SYSTEM_ALERT | WindowManager.LayoutParams.TYPE_SYSTEM_OVERLAY; int screenWidth = windowManager.getDefaultDisplay().getWidth(); int screenHeight = windowManager.getDefaultDisplay().getHeight(); // 屏幕高 params.x = 0; params.y = 0; params.width = screenWidth; if (PadUtils.isPad(this)) { params.height = screenHeight; } else { params.height = screenHeight - getStatusHeight(c); } final View view = views; // topWindow显示到最顶部 windowManager.addView(view, params); new Thread( new Runnable() { @Override public void run() { try { Thread.sleep(2400); clearTopWindow(view); } catch (InterruptedException e) { e.printStackTrace(); } } }) .start(); }
/** 用户注销 */ public void logOff() { try { log.debug("exit app and disconnect xmpp.."); hasLogined = false; notificationService.disconnect(getChatManager()); } catch (Exception e) { log.error("disconnect xmpp error!", e); } MucManager.getInstanse(this).offLine(); showTopWindow(a); ThreadPlatformUtils.shutdownAllTask(); Intent in = new Intent(BroadcastConstans.CANCEELDIOLOG); sendBroadcast(in); IMModelManager.instance().clear(); boolean outline = Preferences.getOutLine(Application.sharePref); if (!outline) { CubeApplication application = getCubeApplication(); application.save(application); } LoginModel.instance().clear(); Intent i = null; if (PadUtils.isPad(this)) { i = new Intent(); i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); i.setClass(this, FacadeActivity.class); i.putExtra("direction", 1); i.putExtra("type", "web"); i.putExtra("isPad", true); i.putExtra("value", "file:///android_asset/www/pad/login.html"); } else { // i = new Intent(); // i.setClass(this, LoginActivity.class); // i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); // i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); i = new Intent(); i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); i.setClass(this, FacadeActivity.class); i.putExtra("value", URL.PHONE_LOGIN_URL); i.putExtra("isPad", false); } activityManager.popAllActivity(); // activityManager.popAllActivityExceptOne(FacadeActivity.class); startActivity(i); }