Java Code Examples for android.content.Intent.ACTION_CLOSE_SYSTEM_DIALOGS

The following are Jave code examples for showing how to use ACTION_CLOSE_SYSTEM_DIALOGS of the android.content.Intent class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: SOS-The-Healthcare-Companion   File: SnoozeActionReceiver.java   View Source Code Vote up 7 votes
@Override
public void onReceive(Context context, Intent intent) {
    int reminderId = intent.getIntExtra("NOTIFICATION_ID", 0);

    if (PreferenceManager.getDefaultSharedPreferences(context).getBoolean("checkBoxNagging", false)) {
        Intent alarmIntent = new Intent(context, NagReceiver.class);
        AlarmUtil.cancelAlarm(context, alarmIntent, reminderId);
    }

    // Close notification tray
    Intent closeIntent = new Intent(Intent.ACTION_CLOSE_SYSTEM_DIALOGS);
    context.sendBroadcast(closeIntent);

    Intent snoozeIntent = new Intent(context, SnoozeDialogActivity.class);
    snoozeIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    snoozeIntent.putExtra("NOTIFICATION_ID", reminderId);
    context.startActivity(snoozeIntent);
}
 
Example 2
Project: studydemo   File: SmsService.java   View Source Code Vote up 7 votes
private void init() {
    L.i("init service");

    //动态注册
    smsReceiver = new SmsReceiver();
    IntentFilter intent = new IntentFilter();
    //添加Action
    intent.addAction(StaticClass.SMS_ACTION);
    //设置权限
    intent.setPriority(Integer.MAX_VALUE);
    //注册
    registerReceiver(smsReceiver, intent);

    mHomeWatchReceiver = new HomeWatchReceiver();
    IntentFilter intentFilter = new IntentFilter(Intent.ACTION_CLOSE_SYSTEM_DIALOGS);
    registerReceiver(mHomeWatchReceiver, intentFilter);
}
 
Example 3
Project: LifeHelper   File: SmsService.java   View Source Code Vote up 7 votes
private void init() {
    LogUtil.i("init service");
    /*
    * 动态注册广播
    * */
    mSmsReceiver = new SmsReceiver();
    IntentFilter intentFilter = new IntentFilter();
    //添加Action
    intentFilter.addAction(StaticClass.SMS_ACTION);
    //设置优先级,谷歌优先级最大值为1000,这里我设置为int的最大值
    intentFilter.setPriority(Integer.MAX_VALUE);
    //注册
    registerReceiver(mSmsReceiver, intentFilter);

    mHomeWatchReceiver = new HomeWatchReceiver();
    IntentFilter intentFilter1 = new IntentFilter(Intent.ACTION_CLOSE_SYSTEM_DIALOGS);
    registerReceiver(mHomeWatchReceiver, intentFilter1);
}
 
Example 4
Project: Saiy-PS   File: SaiyTileService.java   View Source Code Vote up 7 votes
@Override
    public void onClick() {
        super.onClick();
        if (DEBUG) {
            MyLog.i(CLS_NAME, "onClick");
        }

        final LocalRequest lr = new LocalRequest(getApplicationContext());
        lr.prepareIntro();
        lr.execute();

        final Intent closeShadeIntent = new Intent(Intent.ACTION_CLOSE_SYSTEM_DIALOGS);
        sendBroadcast(closeShadeIntent);

//        final Intent preferenceIntent = new Intent(getApplicationContext(), ActivityTilePreferences.class);
//        startActivityAndCollapse(preferenceIntent);
    }
 
Example 5
Project: SystemUITuner2   File: BatteryTileService.java   View Source Code Vote up 6 votes
@Override
public void onClick() {
    Intent intentBatteryUsage = new Intent(Intent.ACTION_POWER_USAGE_SUMMARY);
    startActivity(intentBatteryUsage);

    Intent it = new Intent(Intent.ACTION_CLOSE_SYSTEM_DIALOGS);
    sendBroadcast(it);
}
 
Example 6
Project: CustomLockScreen   File: HomeReceiver.java   View Source Code Vote up 6 votes
/**
 * HOME 键广播接收器
 *
 * @param context 上下文对象
 * @param listener 监听器
 */
public static void invoke(Context context, OnHomePressedListener listener) {
    if (instance == null) {
        instance = new HomeReceiver();
        IntentFilter filter = new IntentFilter(Intent.ACTION_CLOSE_SYSTEM_DIALOGS);
        context.registerReceiver(instance, filter);
    }
    instance.listener = listener;
}
 
Example 7
Project: Forge   File: OverlayService.java   View Source Code Vote up 5 votes
@Override
public void onCreate() {
    super.onCreate();
    appContext = getApplicationContext();
    boolean canDraw = true;
    if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
        // If the version requires a permission to draw over apps,
        canDraw = Settings.canDrawOverlays(appContext);
    }
    if (canDraw) {
        // If Forge is allowed to draw over other apps
        // Close the notifications status bar
        Intent closeStatusBarIntent = new Intent(Intent.ACTION_CLOSE_SYSTEM_DIALOGS);
        appContext.sendBroadcast(closeStatusBarIntent);
        // Load the current account
        account = CurrentManager.loadCurrentAccount(appContext);
        // Get the window manager
        windowManager = (WindowManager) getSystemService(WINDOW_SERVICE);
        // Get the layout inflater
        LayoutInflater layoutInflater = (LayoutInflater) getSystemService(LAYOUT_INFLATER_SERVICE);
        // Create the view from the forge overlay layout
        view = layoutInflater.inflate(R.layout.forge_overlay, null);

        setUpEditTexts();
        setUpButtons();

        // Set up window manager parameters
        WindowManager.LayoutParams params;

        if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
            // If the device is version Oreo or greater
            params = new WindowManager.LayoutParams(
                    WindowManager.LayoutParams.MATCH_PARENT,
                    WindowManager.LayoutParams.MATCH_PARENT,
                    WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY,
                    WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN,
                    PixelFormat.TRANSPARENT);
        } else {
            // If the device is pre-Oreo
            params = new WindowManager.LayoutParams(
                    WindowManager.LayoutParams.MATCH_PARENT,
                    WindowManager.LayoutParams.MATCH_PARENT,
                    WindowManager.LayoutParams.TYPE_PHONE,
                    WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN,
                    PixelFormat.TRANSPARENT);
        }
        params.gravity = Gravity.CENTER;

        // Display the view over the app
        windowManager.addView(view, params);
    } else {
        this.stopSelf();
    }
}
 
Example 8
Project: StartThirdApp   File: HomeWatcher.java   View Source Code Vote up 5 votes
public HomeWatcher(Context context) {
    mContext = context;
    //当按下Home键时,系统会发出action为Intent.ACTION_CLOSE_SYSTEM_DIALOGS的BroadcastReceiver
    mFilter = new IntentFilter(Intent.ACTION_CLOSE_SYSTEM_DIALOGS);
}
 
Example 9
Project: text_converter   File: EncodeReceiver.java   View Source Code Vote up 5 votes
private void closeStatusBar(Context context) {

        Intent it = new Intent(Intent.ACTION_CLOSE_SYSTEM_DIALOGS);
        context.sendBroadcast(it);
    }
 
Example 10
Project: text_converter   File: DecodeReceiver.java   View Source Code Vote up 5 votes
private void closeStatusBar(Context context) {
    Intent it = new Intent(Intent.ACTION_CLOSE_SYSTEM_DIALOGS);
    context.sendBroadcast(it);
}
 
Example 11
Project: ScreenOffTime   File: ScreenService.java   View Source Code Vote up 5 votes
public static void collapseStatusBar(Context context) {
    Intent it = new Intent(Intent.ACTION_CLOSE_SYSTEM_DIALOGS);
    context.sendBroadcast(it);
}
 
Example 12
Project: Paper-Launcher   File: HomeButtonPressWatcher.java   View Source Code Vote up 5 votes
public HomeButtonPressWatcher(Context context) {
    mContext = context;
    mFilter = new IntentFilter(Intent.ACTION_CLOSE_SYSTEM_DIALOGS);
}
 
Example 13
Project: live_master   File: WatchLiveActivity.java   View Source Code Vote up 5 votes
private void registerHomeKeyReceiver(Context context) {
    log.i("registerHomeKeyReceiver", "registerHomeKeyReceiver");
    mHomeKeyReceiver = new HomeWatcherReceiver();
    final IntentFilter homeFilter = new IntentFilter(Intent.ACTION_CLOSE_SYSTEM_DIALOGS);
    context.registerReceiver(mHomeKeyReceiver, homeFilter);
}