Home | History | Annotate | Download | only in testapps

Lines Matching refs:context

25 import android.content.Context;
80 public void updateNotification(Context context) {
82 getNotificationManager(context).notify(CALL_NOTIFICATION_ID, getMainNotification(context));
83 getNotificationManager(context).notify(
84 PHONE_ACCOUNT_NOTIFICATION_ID, getPhoneAccountNotification(context));
90 public void cancelNotifications(Context context) {
92 getNotificationManager(context).cancel(CALL_NOTIFICATION_ID);
93 getNotificationManager(context).cancel(PHONE_ACCOUNT_NOTIFICATION_ID);
99 public void registerPhoneAccount(Context context) {
101 (TelecomManager) context.getSystemService(Context.TELECOM_SERVICE);
107 new ComponentName(context, TestConnectionService.class),
113 .setIcon(context, R.drawable.stat_sys_phone_call, Color.RED)
121 new ComponentName(context, TestConnectionService.class),
128 .setIcon(context, R.drawable.stat_sys_phone_call, Color.GREEN)
135 new ComponentName(context, TestConnectionManager.class),
141 .setIcon(context, R.drawable.stat_sys_phone_call, Color.BLUE)
149 public void showAllPhoneAccounts(Context context) {
151 (TelecomManager) context.getSystemService(Context.TELECOM_SERVICE);
154 Toast.makeText(context, accounts.toString(), Toast.LENGTH_LONG).show();
160 private NotificationManager getNotificationManager(Context context) {
161 return (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
167 private Notification getPhoneAccountNotification(Context context) {
168 final Notification.Builder builder = new Notification.Builder(context);
175 final PendingIntent intent = createShowAllPhoneAccountsIntent(context);
183 addRegisterPhoneAccountAction(builder, context);
184 addShowAllPhoneAccountsAction(builder, context);
192 private Notification getMainNotification(Context context) {
193 final Notification.Builder builder = new Notification.Builder(context);
200 addAddVideoCallAction(builder, context);
201 addAddCallAction(builder, context);
202 addExitAction(builder, context);
210 private PendingIntent createExitIntent(Context context) {
212 context, CallNotificationReceiver.class);
214 return PendingIntent.getBroadcast(context, 0, intent, 0);
220 private PendingIntent createRegisterPhoneAccountIntent(Context context) {
222 null, context, CallNotificationReceiver.class);
223 return PendingIntent.getBroadcast(context, 0, intent, 0);
229 private PendingIntent createShowAllPhoneAccountsIntent(Context context) {
231 null, context, CallNotificationReceiver.class);
232 return PendingIntent.getBroadcast(context, 0, intent, 0);
238 private PendingIntent createIncomingVideoCall(Context context) {
240 null, context, CallNotificationReceiver.class);
241 return PendingIntent.getBroadcast(context, 0, intent, 0);
247 private PendingIntent createIncomingAudioCall(Context context) {
249 null, context, CallNotificationReceiver.class);
250 return PendingIntent.getBroadcast(context, 0, intent, 0);
257 private void addAddCallAction(Notification.Builder builder, Context context) {
258 builder.addAction(0, "Add Call", createIncomingAudioCall(context));
264 private void addAddVideoCallAction(Notification.Builder builder, Context context) {
265 builder.addAction(0, "Add Video", createIncomingVideoCall(context));
271 private void addExitAction(Notification.Builder builder, Context context) {
272 builder.addAction(0, "Exit", createExitIntent(context));
278 private void addShowAllPhoneAccountsAction(Notification.Builder builder, Context context) {
279 builder.addAction(0, "Show Accts", createShowAllPhoneAccountsIntent(context));
285 private void addRegisterPhoneAccountAction(Notification.Builder builder, Context context) {
286 builder.addAction(0, "Reg.Acct.", createRegisterPhoneAccountIntent(context));