public void run() { int timedCount = 0; while (!Thread.interrupted()) { try { Thread.sleep(SEC_POLL_DELAY); } catch (InterruptedException e) { break; } // 5400 seconds = 90 min if (timedCount == 5400) { timedCount = 0; Intent dialogIntent = new Intent(getBaseContext(), BlockerActivity.class); dialogIntent.addFlags( Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK); dialogIntent.putExtra( "AlertInfo", "You've used your phone for 90 minutes NON-STOP. Please take a break!"); getApplication().startActivity(dialogIntent); } timedCount++; synchronized (mPauseLock) { while (mPaused) { try { mPauseLock.wait(); } catch (InterruptedException e) { e.printStackTrace(); } } } } }
/** * Shows <tt>AuthorizationRequestedDialog</tt> for the request with given <tt>id</tt>. * * @param id request identifier for which new dialog will be displayed. */ public static void showDialog(Long id) { Context ctx = JitsiApplication.getGlobalContext(); Intent showIntent = new Intent(ctx, AuthorizationRequestedDialog.class); showIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); showIntent.putExtra(EXTRA_REQUEST_ID, id); ctx.startActivity(showIntent); }
@Override public void onFinish() { Intent intent; if (mPref.getCheckedTutorial() == true) { // 튜토리얼을 했을 경우 intent = new Intent(AC_Loading.this, AC_Main.class); } else { // 튜토리얼을 안했을 경우 intent = new Intent(AC_Loading.this, AC_Help_tutorial.class); } intent.putExtra("tutorial", true); intent.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP); startActivity(intent); overridePendingTransition(R.anim.fadein, R.anim.fadeout); cTimer.cancel(); finish(); }