public override void onIncomingCall(CallClient callClient, Call call) { Log.d(TAG, "onIncomingCall: " + call.CallId); Intent intent = new Intent(outerInstance, typeof(IncomingCallScreenActivity)); intent.putExtra(CALL_ID, call.CallId); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); outerInstance.startActivity(intent); }
public override void onIncomingCall(CallClient callClient, Call call) { Log.d(TAG, "onIncomingCall: " + call.CallId); Intent intent = new Intent(outerInstance, typeof(IncomingCallScreenActivity)); intent.putExtra(CALL_ID, call.CallId); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); outerInstance.startActivity(intent); }
public SearchView(android.content.Context context, android.util.AttributeSet attrs ) : base(context, attrs) { mShowImeRunnable = new _Runnable_137(this); mUpdateDrawableStateRunnable = new _Runnable_148(this); mOnClickListener = new _OnClickListener_787(this); mTextKeyListener = new _OnKeyListener_836(this); mOnEditorActionListener = new _OnEditorActionListener_1059(this); mOnItemClickListener = new _OnItemClickListener_1233(this); mOnItemSelectedListener = new _OnItemSelectedListener_1244(this); mTextWatcher = new _TextWatcher_1530(this); android.view.LayoutInflater inflater = (android.view.LayoutInflater)context.getSystemService (android.content.Context.LAYOUT_INFLATER_SERVICE); inflater.inflate([email protected]_view, this, true); mSearchButton = findViewById([email protected]_button); mQueryTextView = (android.widget.SearchView.SearchAutoComplete)findViewById([email protected] .id.search_src_text); mQueryTextView.setSearchView(this); mSearchEditFrame = findViewById([email protected]_edit_frame); mSearchPlate = findViewById([email protected]_plate); mSubmitArea = findViewById([email protected]_area); mSubmitButton = findViewById([email protected]_go_btn); mCloseButton = (android.widget.ImageView)findViewById([email protected]_close_btn ); mVoiceButton = findViewById([email protected]_voice_btn); mSearchHintIcon = (android.widget.ImageView)findViewById([email protected]_mag_icon ); mSearchButton.setOnClickListener(mOnClickListener); mCloseButton.setOnClickListener(mOnClickListener); mSubmitButton.setOnClickListener(mOnClickListener); mVoiceButton.setOnClickListener(mOnClickListener); mQueryTextView.setOnClickListener(mOnClickListener); mQueryTextView.addTextChangedListener(mTextWatcher); mQueryTextView.setOnEditorActionListener(mOnEditorActionListener); mQueryTextView.setOnItemClickListener(mOnItemClickListener); mQueryTextView.setOnItemSelectedListener(mOnItemSelectedListener); mQueryTextView.setOnKeyListener(mTextKeyListener); mQueryTextView.setOnFocusChangeListener(new _OnFocusChangeListener_265(this)); android.content.res.TypedArray a = context.obtainStyledAttributes(attrs, [email protected] .styleable.SearchView, 0, 0); setIconifiedByDefault(a.getBoolean([email protected]_iconifiedByDefault , true)); int maxWidth = a.getDimensionPixelSize([email protected]_maxWidth , -1); if (maxWidth != -1) { setMaxWidth(maxWidth); } java.lang.CharSequence queryHint = a.getText([email protected]_queryHint ); if (!android.text.TextUtils.isEmpty(queryHint)) { setQueryHint(queryHint); } int imeOptions = a.getInt([email protected]_imeOptions, -1 ); if (imeOptions != -1) { setImeOptions(imeOptions); } int inputType = a.getInt([email protected]_inputType, -1); if (inputType != -1) { setInputType(inputType); } a.recycle(); bool focusable = true; a = context.obtainStyledAttributes(attrs, [email protected], 0, 0); focusable = a.getBoolean([email protected]_focusable, focusable); a.recycle(); setFocusable(focusable); mVoiceWebSearchIntent = new android.content.Intent(android.speech.RecognizerIntent .ACTION_WEB_SEARCH); mVoiceWebSearchIntent.addFlags(android.content.Intent.FLAG_ACTIVITY_NEW_TASK); mVoiceWebSearchIntent.putExtra(android.speech.RecognizerIntent.EXTRA_LANGUAGE_MODEL , android.speech.RecognizerIntent.LANGUAGE_MODEL_WEB_SEARCH); mVoiceAppSearchIntent = new android.content.Intent(android.speech.RecognizerIntent .ACTION_RECOGNIZE_SPEECH); mVoiceAppSearchIntent.addFlags(android.content.Intent.FLAG_ACTIVITY_NEW_TASK); mDropDownAnchor = findViewById(mQueryTextView.getDropDownAnchor()); if (mDropDownAnchor != null) { mDropDownAnchor.addOnLayoutChangeListener(new _OnLayoutChangeListener_313(this)); } updateViewsVisibility(mIconifiedByDefault); updateQueryHint(); }
/// <summary>Constructs an intent from the given information and the search dialog state. /// </summary> /// <remarks>Constructs an intent from the given information and the search dialog state. /// </remarks> /// <param name="action">Intent action.</param> /// <param name="data">Intent data, or <code>null</code>.</param> /// <param name="extraData"> /// Data for /// <see cref="android.app.SearchManager.EXTRA_DATA_KEY">android.app.SearchManager.EXTRA_DATA_KEY /// </see> /// or <code>null</code>. /// </param> /// <param name="query">Intent query, or <code>null</code>.</param> /// <param name="actionKey"> /// The key code of the action key that was pressed, /// or /// <see cref="android.view.KeyEvent.KEYCODE_UNKNOWN">android.view.KeyEvent.KEYCODE_UNKNOWN /// </see> /// if none. /// </param> /// <param name="actionMsg"> /// The message for the action key that was pressed, /// or <code>null</code> if none. /// </param> /// <param name="mode"> /// The search mode, one of the acceptable values for /// <see cref="android.app.SearchManager.SEARCH_MODE">android.app.SearchManager.SEARCH_MODE /// </see> /// , or /// <code>null</code> /// . /// </param> /// <returns>The intent.</returns> private android.content.Intent createIntent(string action, System.Uri data, string extraData, string query, int actionKey, string actionMsg) { // Now build the Intent android.content.Intent intent = new android.content.Intent(action); intent.addFlags(android.content.Intent.FLAG_ACTIVITY_NEW_TASK); // We need CLEAR_TOP to avoid reusing an old task that has other activities // on top of the one we want. We don't want to do this in in-app search though, // as it can be destructive to the activity stack. if (data != null) { intent.setData(data); } intent.putExtra(android.app.SearchManager.USER_QUERY, mUserQuery); if (query != null) { intent.putExtra(android.app.SearchManager.QUERY, query); } if (extraData != null) { intent.putExtra(android.app.SearchManager.EXTRA_DATA_KEY, extraData); } if (mAppSearchData != null) { intent.putExtra(android.app.SearchManager.APP_DATA, mAppSearchData); } if (actionKey != android.view.KeyEvent.KEYCODE_UNKNOWN) { intent.putExtra(android.app.SearchManager.ACTION_KEY, actionKey); intent.putExtra(android.app.SearchManager.ACTION_MSG, actionMsg); } intent.setComponent(mSearchable.getSearchActivity()); return intent; }
public virtual bool onKeyDown(int keyCode, android.view.KeyEvent @event) { if (keyCode == android.view.KeyEvent.KEYCODE_BACK) { if (getApplicationInfo().targetSdkVersion >= android.os.Build.VERSION_CODES.ECLAIR) { @event.startTracking(); } else { onBackPressed(); } return true; } if (mDefaultKeyMode == DEFAULT_KEYS_DISABLE) { return false; } else { if (mDefaultKeyMode == DEFAULT_KEYS_SHORTCUT) { if (getWindow().performPanelShortcut(android.view.Window.FEATURE_OPTIONS_PANEL, keyCode , @event, android.view.MenuClass.FLAG_ALWAYS_PERFORM_CLOSE)) { return true; } return false; } else { bool clearSpannable = false; bool handled; if ((@event.getRepeatCount() != 0) || @event.isSystem()) { clearSpannable = true; handled = false; } else { handled = android.text.method.TextKeyListener.getInstance().onKeyDown(null, mDefaultKeySsb , keyCode, @event); if (handled && mDefaultKeySsb.Length > 0) { string str = mDefaultKeySsb.ToString(); clearSpannable = true; switch (mDefaultKeyMode) { case DEFAULT_KEYS_DIALER: { android.content.Intent intent = new android.content.Intent(android.content.Intent .ACTION_DIAL, Sharpen.Util.ParseUri("tel:" + str)); intent.addFlags(android.content.Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(intent); break; } case DEFAULT_KEYS_SEARCH_LOCAL: { startSearch(str, false, null, false); break; } case DEFAULT_KEYS_SEARCH_GLOBAL: { startSearch(str, false, null, true); break; } } } } if (clearSpannable) { mDefaultKeySsb.clear(); mDefaultKeySsb.clearSpans(); android.text.Selection.setSelection(mDefaultKeySsb, 0); } return handled; } } }
/* * Show the notification in the Android notification drawer */ //JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @TargetApi(android.os.Build.VERSION_CODES.KITKAT_WATCH) private void showNotification(com.twilio.voice.IncomingCallMessage incomingCallMessage, int notificationId) private void showNotification(IncomingCallMessage incomingCallMessage, int notificationId) { string callSid = incomingCallMessage.CallSid; if (!incomingCallMessage.Cancelled) { /* * Create a PendingIntent to specify the action when the notification is * selected in the notification drawer */ Intent intent = new Intent(this, typeof(VoiceActivity)); intent.Action = VoiceActivity.ACTION_INCOMING_CALL; intent.putExtra(VoiceActivity.INCOMING_CALL_MESSAGE, incomingCallMessage); intent.putExtra(VoiceActivity.INCOMING_CALL_NOTIFICATION_ID, notificationId); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, intent, PendingIntent.FLAG_ONE_SHOT); /* * Pass the notification id and call sid to use as an identifier to cancel the * notification later */ Bundle extras = new Bundle(); extras.putInt(NOTIFICATION_ID_KEY, notificationId); extras.putString(CALL_SID_KEY, callSid); /* * Create the notification shown in the notification drawer */ NotificationCompat.Builder notificationBuilder = (new NotificationCompat.Builder(this)).setSmallIcon(R.drawable.ic_call_white_24px).setContentTitle(getString([email protected]_name)).setContentTextuniquetempvar.setAutoCancel(true).setExtras(extras).setContentIntent(pendingIntent).setColor(Color.rgb(214, 10, 37)); notificationManager.notify(notificationId, notificationBuilder.build()); } else { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { /* * If the incoming call was cancelled then remove the notification by matching * it with the call sid from the list of notifications in the notification drawer. */ StatusBarNotification[] activeNotifications = notificationManager.ActiveNotifications; foreach (StatusBarNotification statusBarNotification in activeNotifications) { Notification notification = statusBarNotification.Notification; Bundle extras = notification.extras; string notificationCallSid = extras.getString(CALL_SID_KEY); if (callSid.Equals(notificationCallSid)) { notificationManager.cancel(extras.getInt(NOTIFICATION_ID_KEY)); } } } else { /* * Prior to Android M the notification manager did not provide a list of * active notifications so we lazily clear all the notifications when * receiving a cancelled call. * * In order to properly cancel a notification using * NotificationManager.cancel(notificationId) we should store the call sid & * notification id of any incoming calls using shared preferences or some other form * of persistent storage. */ notificationManager.cancelAll(); } } }
/* * Show the notification in the Android notification drawer */ //JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @TargetApi(android.os.Build.VERSION_CODES.KITKAT_WATCH) private void showNotification(com.twilio.voice.IncomingCallMessage incomingCallMessage, int notificationId) private void showNotification(IncomingCallMessage incomingCallMessage, int notificationId) { string callSid = incomingCallMessage.CallSid; if (!incomingCallMessage.Cancelled) { /* * Create a PendingIntent to specify the action when the notification is * selected in the notification drawer */ Intent intent = new Intent(this, typeof(VoiceActivity)); intent.Action = VoiceActivity.ACTION_INCOMING_CALL; intent.putExtra(VoiceActivity.INCOMING_CALL_MESSAGE, incomingCallMessage); intent.putExtra(VoiceActivity.INCOMING_CALL_NOTIFICATION_ID, notificationId); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, intent, PendingIntent.FLAG_ONE_SHOT); /* * Pass the notification id and call sid to use as an identifier to cancel the * notification later */ Bundle extras = new Bundle(); extras.putInt(NOTIFICATION_ID_KEY, notificationId); extras.putString(CALL_SID_KEY, callSid); /* * Create the notification shown in the notification drawer */ NotificationCompat.Builder notificationBuilder = (new NotificationCompat.Builder(this)).setSmallIcon(R.drawable.ic_call_white_24px).setContentTitle(getString([email protected]_name)).setContentTextuniquetempvar.setAutoCancel(true).setExtras(extras).setContentIntent(pendingIntent).setColor(Color.rgb(214, 10, 37)); notificationManager.notify(notificationId, notificationBuilder.build()); } else { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { /* * If the incoming call was cancelled then remove the notification by matching * it with the call sid from the list of notifications in the notification drawer. */ StatusBarNotification[] activeNotifications = notificationManager.ActiveNotifications; foreach (StatusBarNotification statusBarNotification in activeNotifications) { Notification notification = statusBarNotification.Notification; Bundle extras = notification.extras; string notificationCallSid = extras.getString(CALL_SID_KEY); if (callSid.Equals(notificationCallSid)) { notificationManager.cancel(extras.getInt(NOTIFICATION_ID_KEY)); } } } else { /* * Prior to Android M the notification manager did not provide a list of * active notifications so we lazily clear all the notifications when * receiving a cancelled call. * * In order to properly cancel a notification using * NotificationManager.cancel(notificationId) we should store the call sid & * notification id of any incoming calls using shared preferences or some other form * of persistent storage. */ notificationManager.cancelAll(); } } }