List of usage examples for android.content Intent ACTION_CLOSE_SYSTEM_DIALOGS
String ACTION_CLOSE_SYSTEM_DIALOGS
To view the source code for android.content Intent ACTION_CLOSE_SYSTEM_DIALOGS.
Click Source Link
From source file:de.teambluebaer.patientix.activities.EndActivity.java
/** * This method kills all system dialogs if they are shown * * @param hasFocus/*w w w . ja va2s . c om*/ */ @Override public void onWindowFocusChanged(boolean hasFocus) { super.onWindowFocusChanged(hasFocus); if (!hasFocus) { // Close every kind of system dialog Intent closeDialog = new Intent(Intent.ACTION_CLOSE_SYSTEM_DIALOGS); sendBroadcast(closeDialog); } }
From source file:com.hellofyc.base.app.activity.BaseActivity.java
private void registerEntityKeyReceiver() { if (mKeyReciver == null) { mKeyReciver = new KeyReciver(); }//w w w . jav a 2 s . c o m IntentFilter filter = new IntentFilter(Intent.ACTION_CLOSE_SYSTEM_DIALOGS); registerReceiver(mKeyReciver, filter); }
From source file:org.proninyaroslav.libretorrent.fragments.MainFragment.java
@Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); if (activity == null) { activity = (AppCompatActivity) getActivity(); }//from www . j a va2s . co m showBlankFragment(); sync = new ReentrantLock(); toolbar = (Toolbar) activity.findViewById(R.id.toolbar); if (toolbar != null) { toolbar.setTitle(R.string.app_name); } View spinnerContainer = LayoutInflater.from(activity).inflate(R.layout.toolbar_spinner, toolbar, false); ActionBar.LayoutParams lp = new ActionBar.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT); toolbar.addView(spinnerContainer, lp); spinnerAdapter = new ToolbarSpinnerAdapter(activity); spinnerAdapter.addItems(getSpinnerList()); spinner = (Spinner) spinnerContainer.findViewById(R.id.toolbar_spinner); spinner.setAdapter(spinnerAdapter); spinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { @Override public void onItemSelected(AdapterView<?> adapterView, View view, int i, long l) { setTorrentListFilter(spinnerAdapter.getItem(i)); } @Override public void onNothingSelected(AdapterView<?> adapterView) { /* Nothing */ } }); activity.setSupportActionBar(toolbar); setHasOptionsMenu(true); addTorrentButton = (FloatingActionMenu) activity.findViewById(R.id.add_torrent_button); addTorrentButton.setClosedOnTouchOutside(true); openFileButton = (FloatingActionButton) activity.findViewById(R.id.open_file_button); openFileButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { addTorrentButton.close(true); torrentFileChooserDialog(); } }); addLinkButton = (FloatingActionButton) activity.findViewById(R.id.add_link_button); addLinkButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { addTorrentButton.close(true); addLinkDialog(); } }); if (savedInstanceState != null) { prevImplIntent = savedInstanceState.getParcelable(TAG_PREV_IMPL_INTENT); } activity.bindService(new Intent(activity.getApplicationContext(), TorrentTaskService.class), connection, Context.BIND_AUTO_CREATE); torrentsList = (EmptyRecyclerView) activity.findViewById(R.id.torrent_list); layoutManager = new LinearLayoutManager(activity); torrentsList.setLayoutManager(layoutManager); /* * A RecyclerView by default creates another copy of the ViewHolder in order to * fade the views into each other. This causes the problem because the old ViewHolder gets * the payload but then the new one doesn't. So needs to explicitly tell it to reuse the old one. */ DefaultItemAnimator animator = new DefaultItemAnimator() { @Override public boolean canReuseUpdatedViewHolder(RecyclerView.ViewHolder viewHolder) { return true; } }; torrentsList.setItemAnimator(animator); torrentsList.addItemDecoration(new RecyclerViewDividerDecoration(activity.getApplicationContext(), R.drawable.torrent_list_divider)); torrentsList.setEmptyView(activity.findViewById(R.id.empty_view_torrent_list)); adapter = new TorrentListAdapter(new ArrayList<TorrentStateParcel>(), activity, R.layout.item_torrent_list, this); setTorrentListFilter((String) spinner.getSelectedItem()); torrentsList.setAdapter(adapter); Intent i = activity.getIntent(); /* If add torrent dialog has been called by an implicit intent */ if (i != null && i.hasExtra(AddTorrentActivity.TAG_RESULT_TORRENT)) { if (prevImplIntent == null || !prevImplIntent.equals(i)) { prevImplIntent = i; Torrent torrent = i.getParcelableExtra(AddTorrentActivity.TAG_RESULT_TORRENT); if (torrent != null) { ArrayList<Torrent> list = new ArrayList<>(); list.add(torrent); addTorrentsRequest(list); } } } else if (i != null && i.getAction() != null) { switch (i.getAction()) { case NotificationReceiver.NOTIFY_ACTION_ADD_TORRENT: addTorrentMenu = true; /* Prevents re-reading action after device configuration changes */ i.setAction(null); break; } } /* Show add torrent menu (called from service) after window is displayed */ activity.getWindow().findViewById(android.R.id.content).post(new Runnable() { @Override public void run() { if (addTorrentMenu) { /* Hide notification bar */ activity.sendBroadcast(new Intent(Intent.ACTION_CLOSE_SYSTEM_DIALOGS)); addTorrentMenu = false; View v = activity.getWindow().findViewById(android.R.id.content); registerForContextMenu(v); activity.openContextMenu(v); unregisterForContextMenu(v); } } }); if (savedInstanceState != null) { selectedTorrents = savedInstanceState.getStringArrayList(TAG_SELECTED_TORRENTS); if (savedInstanceState.getBoolean(TAG_IN_ACTION_MODE, false)) { actionMode = activity.startActionMode(actionModeCallback); adapter.setSelectedItems(savedInstanceState.getIntegerArrayList(TAG_SELECTABLE_ADAPTER)); actionMode.setTitle(String.valueOf(adapter.getSelectedItemCount())); } } }
From source file:com.ferdi2005.secondgram.NotificationsController.java
protected void forceShowPopupForReply() { notificationsQueue.postRunnable(new Runnable() { @Override/* w ww . ja va 2 s . c om*/ public void run() { final ArrayList<MessageObject> popupArray = new ArrayList<>(); for (int a = 0; a < pushMessages.size(); a++) { MessageObject messageObject = pushMessages.get(a); long dialog_id = messageObject.getDialogId(); if (messageObject.messageOwner.mentioned && messageObject.messageOwner.action instanceof TLRPC.TL_messageActionPinMessage || (int) dialog_id == 0 || messageObject.messageOwner.to_id.channel_id != 0 && !messageObject.isMegagroup()) { continue; } popupArray.add(0, messageObject); } if (!popupArray.isEmpty() && !AndroidUtilities.needShowPasscode(false)) { AndroidUtilities.runOnUIThread(new Runnable() { @Override public void run() { popupReplyMessages = popupArray; Intent popupIntent = new Intent(ApplicationLoader.applicationContext, PopupNotificationActivity.class); popupIntent.putExtra("force", true); popupIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_NO_ANIMATION | Intent.FLAG_ACTIVITY_NO_USER_ACTION | Intent.FLAG_FROM_BACKGROUND); ApplicationLoader.applicationContext.startActivity(popupIntent); Intent it = new Intent(Intent.ACTION_CLOSE_SYSTEM_DIALOGS); ApplicationLoader.applicationContext.sendBroadcast(it); } }); } } }); }
From source file:com.dudu.aios.ui.activity.MainRecordActivity.java
private void registerScreenReceiver() { mScreenReceiver = new ScreenReceiver(); IntentFilter filter = new IntentFilter(); // ???// w w w. j av a2s. c om filter.addAction(Intent.ACTION_SCREEN_OFF); // ?? filter.addAction(Intent.ACTION_SCREEN_ON); // ?? filter.addAction(Intent.ACTION_USER_PRESENT); // ?????? // example????????? // ????pad?? filter.addAction(Intent.ACTION_CLOSE_SYSTEM_DIALOGS); registerReceiver(mScreenReceiver, filter); }
From source file:com.android.launcher2.Launcher.java
@Override protected void onCreate(Bundle savedInstanceState) { if (DEBUG_STRICT_MODE) { StrictMode.setThreadPolicy(//from w ww . j a va 2 s .c om new StrictMode.ThreadPolicy.Builder().detectDiskReads().detectDiskWrites().detectNetwork() // or .detectAll() for all detectable problems .penaltyLog().build()); StrictMode.setVmPolicy(new StrictMode.VmPolicy.Builder().detectLeakedSqlLiteObjects() .detectLeakedClosableObjects().penaltyLog().penaltyDeath().build()); } super.onCreate(savedInstanceState); LauncherApplication app = ((LauncherApplication) getApplication()); mSharedPrefs = getSharedPreferences(LauncherApplication.getSharedPreferencesKey(), Context.MODE_PRIVATE); mModel = app.setLauncher(this); mIconCache = app.getIconCache(); mDragController = new DragController(this); mInflater = getLayoutInflater(); mAppWidgetManager = AppWidgetManager.getInstance(this); mAppWidgetHost = new LauncherAppWidgetHost(this, APPWIDGET_HOST_ID); mAppWidgetHost.startListening(); // If we are getting an onCreate, we can actually preempt onResume and unset mPaused here, // this also ensures that any synchronous binding below doesn't re-trigger another // LauncherModel load. mPaused = false; if (PROFILE_STARTUP) { android.os.Debug.startMethodTracing(Environment.getExternalStorageDirectory() + "/launcher"); } checkForLocaleChange(); setContentView(R.layout.launcher); setupViews(); showFirstRunWorkspaceCling(); registerContentObservers(); lockAllApps(); mSavedState = savedInstanceState; restoreState(mSavedState); // Update customization drawer _after_ restoring the states if (mAppsCustomizeContent != null) { mAppsCustomizeContent.onPackagesUpdated(); } if (PROFILE_STARTUP) { android.os.Debug.stopMethodTracing(); } if (!mRestoring) { if (sPausedFromUserAction) { // If the user leaves launcher, then we should just load items asynchronously when // they return. mModel.startLoader(true, -1); } else { // We only load the page synchronously if the user rotates (or triggers a // configuration change) while launcher is in the foreground mModel.startLoader(true, mWorkspace.getCurrentPage()); } } if (!mModel.isAllAppsLoaded()) { ViewGroup appsCustomizeContentParent = (ViewGroup) mAppsCustomizeContent.getParent(); mInflater.inflate(R.layout.apps_customize_progressbar, appsCustomizeContentParent); } // For handling default keys mDefaultKeySsb = new SpannableStringBuilder(); Selection.setSelection(mDefaultKeySsb, 0); IntentFilter filter = new IntentFilter(Intent.ACTION_CLOSE_SYSTEM_DIALOGS); registerReceiver(mCloseSystemDialogsReceiver, filter); updateGlobalIcons(); // On large interfaces, we want the screen to auto-rotate based on the current orientation unlockScreenOrientation(true); }
From source file:io.teak.sdk.TeakNotification.java
static void cancel(Context context, int platformId) { if (notificationManager == null) { try {//from www . ja v a 2 s . c o m notificationManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE); } catch (Exception e) { Log.e(LOG_TAG, Log.getStackTraceString(e)); return; } } if (Teak.isDebug) { Log.d(LOG_TAG, "Canceling notification id: " + platformId); } notificationManager.cancel(NOTIFICATION_TAG, platformId); context.sendBroadcast(new Intent(Intent.ACTION_CLOSE_SYSTEM_DIALOGS)); Thread updateThread = TeakNotification.notificationUpdateThread.get(platformId); if (updateThread != null) { updateThread.interrupt(); } }
From source file:com.android.leanlauncher.LauncherTransitionable.java
@Override protected void onCreate(Bundle savedInstanceState) { if (DEBUG_STRICT_MODE) { StrictMode.setThreadPolicy(// w w w. ja v a2s . c om new StrictMode.ThreadPolicy.Builder().detectDiskReads().detectDiskWrites().detectNetwork() // or .detectAll() for all detectable problems .penaltyLog().build()); StrictMode.setVmPolicy(new StrictMode.VmPolicy.Builder().detectLeakedSqlLiteObjects() .detectLeakedClosableObjects().penaltyLog().penaltyDeath().build()); } super.onCreate(savedInstanceState); LauncherAppState.setApplicationContext(getApplicationContext()); LauncherAppState app = LauncherAppState.getInstance(); // Lazy-initialize the dynamic grid DeviceProfile grid = app.initDynamicGrid(this); mIsSafeModeEnabled = getPackageManager().isSafeMode(); mModel = app.setLauncher(this); mIconCache = app.getIconCache(); mIconCache.flushInvalidIcons(grid); mDragController = new DragController(this); mInflater = getLayoutInflater(); mAppWidgetManager = AppWidgetManagerCompat.getInstance(this); mAppWidgetHost = new LauncherAppWidgetHost(this, APPWIDGET_HOST_ID); mAppWidgetHost.startListening(); // If we are getting an onCreate, we can actually preempt onResume and unset mPaused here, // this also ensures that any synchronous binding below doesn't re-trigger another // LauncherModel load. mPaused = false; if (PROFILE_STARTUP) { android.os.Debug.startMethodTracing(Environment.getExternalStorageDirectory() + "/launcher"); } checkForLocaleChange(); setContentView(R.layout.launcher); setupViews(); grid.layout(this); registerContentObservers(); mSavedState = savedInstanceState; restoreState(mSavedState); if (PROFILE_STARTUP) { android.os.Debug.stopMethodTracing(); } if (!mRestoring) { // We only load the page synchronously if the user rotates (or triggers a // configuration change) while launcher is in the foreground mModel.startLoader(true, 0); } IntentFilter filter = new IntentFilter(Intent.ACTION_CLOSE_SYSTEM_DIALOGS); registerReceiver(mCloseSystemDialogsReceiver, filter); }
From source file:com.gxapplications.android.gxsuite.launcher.Launcher.java
@SuppressWarnings("unused") @Override/*from w ww. jav a 2 s. co m*/ protected void onCreate(Bundle savedInstanceState) { if (DEBUG_STRICT_MODE) { StrictMode.setThreadPolicy( new StrictMode.ThreadPolicy.Builder().detectDiskReads().detectDiskWrites().detectNetwork() // or .detectAll() for all detectable problems .penaltyLog().build()); StrictMode.setVmPolicy(new StrictMode.VmPolicy.Builder().detectLeakedSqlLiteObjects() .detectLeakedClosableObjects().penaltyLog().penaltyDeath().build()); } super.onCreate(savedInstanceState); LauncherApplication app = ((LauncherApplication) getApplication()); mSharedPrefs = getSharedPreferences(LauncherApplication.getSharedPreferencesKey(), Context.MODE_PRIVATE); mModel = app.setLauncher(this); mIconCache = app.getIconCache(); mDragController = new DragController(this); mInflater = getLayoutInflater(); mAppWidgetManager = AppWidgetManager.getInstance(this); mAppWidgetHost = new LauncherAppWidgetHost(this, APPWIDGET_HOST_ID); mAppWidgetHost.startListening(); // If we are getting an onCreate, we can actually preempt onResume and unset mPaused here, // this also ensures that any synchronous binding below doesn't re-trigger another // LauncherModel load. mPaused = false; if (PROFILE_STARTUP) { android.os.Debug.startMethodTracing(Environment.getExternalStorageDirectory() + "/launcher"); } checkForLocaleChange(); if (MainConfiguration.SCREEN_COUNT == 2) { if (MainConfiguration.ALLOW_DRAWER) setContentView(R.layout.drawer_launcher_2); else setContentView(R.layout.launcher_2); } else if (MainConfiguration.SCREEN_COUNT == 3) { if (MainConfiguration.ALLOW_DRAWER) setContentView(R.layout.drawer_launcher_3); else setContentView(R.layout.launcher_3); } else if (MainConfiguration.SCREEN_COUNT == 4) { if (MainConfiguration.ALLOW_DRAWER) setContentView(R.layout.drawer_launcher_4); else setContentView(R.layout.launcher_4); } else if (MainConfiguration.SCREEN_COUNT == 5) { if (MainConfiguration.ALLOW_DRAWER) setContentView(R.layout.drawer_launcher_5); else setContentView(R.layout.launcher_5); } else if (MainConfiguration.SCREEN_COUNT == 6) { if (MainConfiguration.ALLOW_DRAWER) setContentView(R.layout.drawer_launcher_6); else setContentView(R.layout.launcher_6); } else if (MainConfiguration.SCREEN_COUNT == 7) { if (MainConfiguration.ALLOW_DRAWER) setContentView(R.layout.drawer_launcher_7); else setContentView(R.layout.launcher_7); } else { setContentView(R.layout.launcher_5); } setupViews(); showFirstRunWorkspaceCling(); if (MainConfiguration.ALLOW_DRAWER) { this.drawerLayout = (DrawerLayout) this.findViewById(R.id.drawer_layout); ((LauncherDrawerLayout) this.drawerLayout).postInit(this, this.mWorkspace, this.mSharedPrefs); } registerContentObservers(); lockAllApps(); mSavedState = savedInstanceState; restoreState(mSavedState); // Update customization drawer _after_ restoring the states if (mAppsCustomizeContent != null) { mAppsCustomizeContent.onPackagesUpdated(); } if (PROFILE_STARTUP) { android.os.Debug.stopMethodTracing(); } if (!mRestoring) { if (sPausedFromUserAction) { // If the user leaves launcher, then we should just load items asynchronously when // they return. mModel.startLoader(true, -1); } else { // We only load the page synchronously if the user rotates (or triggers a // configuration change) while launcher is in the foreground mModel.startLoader(true, mWorkspace.getCurrentPage()); } } if (!mModel.isAllAppsLoaded()) { ViewGroup appsCustomizeContentParent = (ViewGroup) mAppsCustomizeContent.getParent(); mInflater.inflate(R.layout.apps_customize_progressbar, appsCustomizeContentParent); } // For handling default keys mDefaultKeySsb = new SpannableStringBuilder(); Selection.setSelection(mDefaultKeySsb, 0); IntentFilter filter = new IntentFilter(Intent.ACTION_CLOSE_SYSTEM_DIALOGS); registerReceiver(mCloseSystemDialogsReceiver, filter); updateGlobalIcons(); // On large interfaces, we want the screen to auto-rotate based on the current orientation unlockScreenOrientation(true); }
From source file:xyz.klinker.blur.launcher3.Launcher.java
@Override protected void onCreate(Bundle savedInstanceState) { if (DEBUG_STRICT_MODE) { StrictMode.setThreadPolicy(/*w w w.ja v a 2 s . c om*/ new StrictMode.ThreadPolicy.Builder().detectDiskReads().detectDiskWrites().detectNetwork() // or .detectAll() for all detectable problems .penaltyLog().build()); StrictMode.setVmPolicy(new StrictMode.VmPolicy.Builder().detectLeakedSqlLiteObjects() .detectLeakedClosableObjects().penaltyLog().penaltyDeath().build()); } predictiveAppsProvider = new PredictiveAppsProvider(this); if (mLauncherCallbacks != null) { mLauncherCallbacks.preOnCreate(); } try { super.onCreate(savedInstanceState); } catch (Exception e) { super.onCreate(new Bundle()); } UpdateUtils.checkUpdate(this); LauncherAppState app = LauncherAppState.getInstance(); // Load configuration-specific DeviceProfile mDeviceProfile = getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE ? app.getInvariantDeviceProfile().landscapeProfile : app.getInvariantDeviceProfile().portraitProfile; mSharedPrefs = Utilities.getPrefs(this); mIsSafeModeEnabled = getPackageManager().isSafeMode(); mModel = app.setLauncher(this); mIconCache = app.getIconCache(); mDragController = new DragController(this); mInflater = getLayoutInflater(); mStateTransitionAnimation = new LauncherStateTransitionAnimation(this); mStats = new Stats(this); mAppWidgetManager = AppWidgetManagerCompat.getInstance(this); mAppWidgetHost = new LauncherAppWidgetHost(this, APPWIDGET_HOST_ID); mAppWidgetHost.startListening(); // If we are getting an onCreate, we can actually preempt onResume and unset mPaused here, // this also ensures that any synchronous binding below doesn't re-trigger another // LauncherModel load. mPaused = false; if (PROFILE_STARTUP) { android.os.Debug.startMethodTracing(Environment.getExternalStorageDirectory() + "/launcher"); } setContentView(R.layout.launcher); app.getInvariantDeviceProfile().landscapeProfile.setSearchBarHeight(getSearchBarHeight()); app.getInvariantDeviceProfile().portraitProfile.setSearchBarHeight(getSearchBarHeight()); setupViews(); setUpBlur(); mDeviceProfile.layout(this); lockAllApps(); mSavedState = savedInstanceState; restoreState(mSavedState); if (PROFILE_STARTUP) { android.os.Debug.stopMethodTracing(); } if (!mRestoring) { if (DISABLE_SYNCHRONOUS_BINDING_CURRENT_PAGE) { // If the user leaves launcher, then we should just load items asynchronously when // they return. mModel.startLoader(PagedView.INVALID_RESTORE_PAGE); } else { // We only load the page synchronously if the user rotates (or triggers a // configuration change) while launcher is in the foreground mModel.startLoader(mWorkspace.getRestorePage()); } } // For handling default keys mDefaultKeySsb = new SpannableStringBuilder(); Selection.setSelection(mDefaultKeySsb, 0); IntentFilter filter = new IntentFilter(Intent.ACTION_CLOSE_SYSTEM_DIALOGS); registerReceiver(mCloseSystemDialogsReceiver, filter); mRotationEnabled = getResources().getBoolean(R.bool.allow_rotation); // In case we are on a device with locked rotation, we should look at preferences to check // if the user has specifically allowed rotation. if (!mRotationEnabled) { mRotationEnabled = Utilities.isAllowRotationPrefEnabled(getApplicationContext()); } // On large interfaces, or on devices that a user has specifically enabled screen rotation, // we want the screen to auto-rotate based on the current orientation setOrientation(); if (mLauncherCallbacks != null) { mLauncherCallbacks.onCreate(savedInstanceState); } if (shouldShowIntroScreen()) { showIntroScreen(); } else { showFirstRunActivity(); showFirstRunClings(); } }