Beispiel #1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Override @NonNull public android.app.Dialog onCreateDialog(android.os.Bundle savedInstanceState)
        public override Dialog onCreateDialog(Bundle savedInstanceState)
        {
            Bundle args    = Arguments;
            string title   = args.getString(KEY_TITLE);
            string message = args.getString(KEY_MESSAGE);

            AlertDialog.Builder builder = new AlertDialog.Builder(Activity);
            builder.setTitle(title).setMessage(message).setPositiveButton([email protected], new OnClickListenerAnonymousInnerClassHelper(this));

            return(builder.create());
        }
            public virtual void onItemSelected(View arg0, int arg1, object arg2)
            {
                Bundle bundle = (Bundle)arg2;

                if (bundle != null)
                {
                    string name = bundle.getString(SlookAirButtonFrequentContactAdapter.DISPLAY_NAME);
                    string data = bundle.getString(SlookAirButtonFrequentContactAdapter.DATA);

                    Toast.makeTextuniquetempvar.show();
                }
            }
 protected internal override void onCreate(android.os.Bundle savedInstanceState)
 {
     base.onCreate(savedInstanceState);
     android.os.Bundle extras = getIntent().getExtras();
     if (extras == null)
     {
         finish();
         return;
     }
     mNumDeletes = extras.getLong("numDeletes");
     mAccount    = (android.accounts.Account)extras.getParcelable("account");
     mAuthority  = extras.getString("authority");
     mProvider   = extras.getString("provider");
     // the order of these must match up with the constants for position used in onItemClick
     java.lang.CharSequence[] options = new java.lang.CharSequence[] { getResources().
                                                                       getText([email protected][email protected]_really_delete), getResources().getText(
                                                                           [email protected][email protected]_undo_deletes), getResources().getText([email protected]
                                                                                                                                                  [email protected]_do_nothing) };
     android.widget.ListAdapter adapter = new android.widget.ArrayAdapter <java.lang.CharSequence
                                                                           >(this, android.R.layout.simple_list_item_1, android.R.id.text1, options);
     android.widget.ListView listView = new android.widget.ListView(this);
     listView.setAdapter(adapter);
     listView.setItemsCanFocus(true);
     listView.setOnItemClickListener(this);
     android.widget.TextView textView = new android.widget.TextView(this);
     java.lang.CharSequence  tooManyDeletesDescFormat = getResources().getText([email protected]
                                                                               [email protected]_too_many_deletes_desc);
     textView.setText(java.lang.CharSequenceProxy.Wrap(string.Format(tooManyDeletesDescFormat
                                                                     .ToString(), mNumDeletes, mProvider, mAccount.name)));
     android.widget.LinearLayout ll = new android.widget.LinearLayout(this);
     ll.setOrientation(android.widget.LinearLayout.VERTICAL);
     android.widget.LinearLayout.LayoutParams lp = new android.widget.LinearLayout.LayoutParams
                                                       (android.view.ViewGroup.LayoutParams.MATCH_PARENT, android.view.ViewGroup.LayoutParams
                                                       .WRAP_CONTENT, 0);
     ll.addView(textView, lp);
     ll.addView(listView, lp);
     // TODO: consider displaying the icon of the account type
     //        AuthenticatorDescription[] descs = AccountManager.get(this).getAuthenticatorTypes();
     //        for (AuthenticatorDescription desc : descs) {
     //            if (desc.type.equals(mAccount.type)) {
     //                try {
     //                    final Context authContext = createPackageContext(desc.packageName, 0);
     //                    ImageView imageView = new ImageView(this);
     //                    imageView.setImageDrawable(authContext.getResources().getDrawable(desc.iconId));
     //                    ll.addView(imageView, lp);
     //                } catch (PackageManager.NameNotFoundException e) {
     //                }
     //                break;
     //            }
     //        }
     setContentView(ll);
 }
        public override void handleMessage(Message msg)
        {
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final android.os.Bundle bundle = msg.getData();
            Bundle bundle = msg.Data;

//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final int action = bundle.getInt(ACTION);
            int action = bundle.getInt(ACTION);
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final String timestamp = bundle.getString(TIMESTAMP);
            string timestamp = bundle.getString(TIMESTAMP);

            switch (action)
            {
            case ADD_TIMESTAMP:
                realm.beginTransaction();
                realm.createObject(typeof(TimeStamp)).TimeStamp = timestamp;
                realm.commitTransaction();
                break;

            case REMOVE_TIMESTAMP:
                realm.beginTransaction();
                realm.@where(typeof(TimeStamp)).equalTo("timeStamp", timestamp).findAll().clear();
                realm.commitTransaction();
                break;
            }
        }
Beispiel #5
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Override @NonNull public android.app.Dialog onCreateDialog(android.os.Bundle savedInstanceState)
        public override Dialog onCreateDialog(Bundle savedInstanceState)
        {
            Bundle args = Arguments;
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final String title = args.getString(KEY_TITLE);
            string title = args.getString(KEY_TITLE);

//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final String[] items = args.getStringArray(KEY_ITEMS);
            string[] items = args.getStringArray(KEY_ITEMS);

            AlertDialog.Builder builder = new AlertDialog.Builder(Activity);
            builder.setTitle(title).setItems(items, new OnClickListenerAnonymousInnerClassHelper(this, title, items));
            return(builder.create());
        }
        /*
         * 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();
                }
            }
        }