Android Open Source - screenstandby Outcoming Call Receiver






From Project

Back to project page screenstandby.

License

The source code is released under:

GNU General Public License

If you think the Android project screenstandby listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

/*******************************************************************************
 * Copyright (c) 2014 Hoang Nguyen.//  www.  j  av a2 s . com
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the GNU Public License v2.0
 * which accompanies this distribution, and is available at
 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
 * 
 * Contributors:
 *     Hoang Nguyen - initial API and implementation
 ******************************************************************************/
package com.nkahoang.screenstandby;

import java.util.HashMap;

import com.nkahoang.screenstandby.remotecontrol.ClientService;
import com.nkahoang.screenstandby.remotecontrol.ServerService;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.preference.PreferenceManager;

public class OutcomingCallReceiver extends BroadcastReceiver {
  public OutcomingCallReceiver() {
  }

  @Override
  public void onReceive(Context context, Intent intent) {
        SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
        if (prefs.getBoolean("useautodialer", false))
        {
            String dialedNumber = intent.getStringExtra(
                    Intent.EXTRA_PHONE_NUMBER).trim();
            HashMap<String,SettingActivity.CallAction> actions = SettingActivity.CallAction.GetActions(prefs);
            if (actions.containsKey(dialedNumber))
            {
              SettingActivity.CallAction act = actions.get(dialedNumber);
              switch (act.GetAction())
              {
                case 0:
                  Intent intentActivity = new Intent(context, Main.class);
                  intentActivity.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
                  context.startActivity(intentActivity);
                  break;
                case 1:
                  Intent intentToggle = new Intent("com.nkahoang.screenstandby.action.TOGGLE");
                  context.sendBroadcast(intentToggle);
                  break;
                case 2:
                  Intent intentRemote = new Intent("com.nkahoang.screenstandby.action.REMOTE_CONTROL");
                  context.sendBroadcast(intentRemote);
                  break;
                case 3:
                case 4:
                      Intent LaunchIntent = context.getPackageManager().getLaunchIntentForPackage(act.GetAppPackage());
                      context.startActivity(LaunchIntent);
                  break;
              }
                setResultData(null);
            }
        }
  }
}




Java Source Code List

android.os.UEventObserver.java
com.nkahoang.kernelswitchobserver.DockObserver.java
com.nkahoang.kernelswitchobserver.GenericHardwareObserver.java
com.nkahoang.kernelswitchobserver.HDMIObserver.java
com.nkahoang.kernelswitchobserver.HardwareNotFoundException.java
com.nkahoang.kernelswitchobserver.HeadsetObserver.java
com.nkahoang.kernelswitchobserver.UEventStateChangeHandler.java
com.nkahoang.screenstandby.AppDetector.java
com.nkahoang.screenstandby.AutoSettingWizard.java
com.nkahoang.screenstandby.BTReceiver.java
com.nkahoang.screenstandby.BackupHelper.java
com.nkahoang.screenstandby.BaseActivity.java
com.nkahoang.screenstandby.BootTimeReceiver.java
com.nkahoang.screenstandby.ChangeLogHandler.java
com.nkahoang.screenstandby.DisableActivity.java
com.nkahoang.screenstandby.DockReceiver.java
com.nkahoang.screenstandby.EnableActivity.java
com.nkahoang.screenstandby.ExceptionHandler.java
com.nkahoang.screenstandby.FlowLayout.java
com.nkahoang.screenstandby.FontManager.java
com.nkahoang.screenstandby.HDMIReceiver.java
com.nkahoang.screenstandby.HUDNative.java
com.nkahoang.screenstandby.HeadsetReceiver.java
com.nkahoang.screenstandby.IconContextMenu.java
com.nkahoang.screenstandby.Logger.java
com.nkahoang.screenstandby.Main.java
com.nkahoang.screenstandby.ManualBrightnessChangerActivity.java
com.nkahoang.screenstandby.MediaButtonControlReceiver.java
com.nkahoang.screenstandby.NotificationBar.java
com.nkahoang.screenstandby.NumberPickerButton.java
com.nkahoang.screenstandby.NumberPicker.java
com.nkahoang.screenstandby.OneTwoDimmer.java
com.nkahoang.screenstandby.OutcomingCallReceiver.java
com.nkahoang.screenstandby.PreferenceListFragment.java
com.nkahoang.screenstandby.RemoteControlSelectActivity.java
com.nkahoang.screenstandby.RemoteControllerActivity.java
com.nkahoang.screenstandby.RemoteServerActivity.java
com.nkahoang.screenstandby.ServiceToggleReceiver.java
com.nkahoang.screenstandby.SettingActivity.java
com.nkahoang.screenstandby.ShortcutActivity.java
com.nkahoang.screenstandby.ShortcutOnActivity.java
com.nkahoang.screenstandby.StandbyService.java
com.nkahoang.screenstandby.StandbyToggleReceiver.java
com.nkahoang.screenstandby.StandbyWidgetProvider2by2.java
com.nkahoang.screenstandby.StandbyWidgetProvider.java
com.nkahoang.screenstandby.TimePickerDialog.java
com.nkahoang.screenstandby.TimePicker.java
com.nkahoang.screenstandby.TroubleshootingActivity.java
com.nkahoang.screenstandby.VolumeKeyDetector.java
com.nkahoang.screenstandby.XTopDPIChanger.java
com.nkahoang.screenstandby.remotecontrol.ClientService.java
com.nkahoang.screenstandby.remotecontrol.Core.java
com.nkahoang.screenstandby.remotecontrol.OnClientStateChangedHandler.java
com.nkahoang.screenstandby.remotecontrol.OnServiceAddressResolvedHandler.java
com.nkahoang.screenstandby.remotecontrol.OnStateChangedHandler.java
com.nkahoang.screenstandby.remotecontrol.RemoteAppPackages.java
com.nkahoang.screenstandby.remotecontrol.RemotePackageInfo.java
com.nkahoang.screenstandby.remotecontrol.ServerService.java
com.nkahoang.screenstandby.remotecontrol.ServiceBinder.java
com.nkahoang.screenstandby.settings.DeviceSettings.java
com.nkahoang.screenstandby.settings.RootChecker.java
com.nkahoang.screenstandby.settings.UpdateChecker.java