public ViewHolder(ViewGroup parent)
     : base(LayoutInflater.From(parent.Context).Inflate(Resource.Layout.participant_item, parent, false))
 {
     mAvatar  = ItemView.FindViewById <AtlasAvatar>(Resource.Id.avatar);
     mTitle   = ItemView.FindViewById <TextView>(Resource.Id.title);
     mBlocked = ItemView.FindViewById <ImageView>(Resource.Id.blocked);
 }
コード例 #2
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            // View cache
            mAvatar                = FindViewById <AtlasAvatar>(Resource.Id.avatar);
            mUserName              = FindViewById <TextView>(Resource.Id.user_name);
            mUserState             = FindViewById <TextView>(Resource.Id.user_state);
            mLogoutButton          = FindViewById <Button>(Resource.Id.logout_button);
            mShowNotifications     = FindViewById <Switch>(Resource.Id.show_notifications_switch);
            mVerboseLogging        = FindViewById <Switch>(Resource.Id.logging_switch);
            mAppVersion            = FindViewById <TextView>(Resource.Id.app_version);
            mAtlasVersion          = FindViewById <TextView>(Resource.Id.atlas_version);
            mLayerVersion          = FindViewById <TextView>(Resource.Id.layer_version);
            mAndroidVersion        = FindViewById <TextView>(Resource.Id.android_version);
            mUserId                = FindViewById <TextView>(Resource.Id.user_id);
            mConversationCount     = FindViewById <TextView>(Resource.Id.conversation_count);
            mMessageCount          = FindViewById <TextView>(Resource.Id.message_count);
            mUnreadMessageCount    = FindViewById <TextView>(Resource.Id.unread_message_count);
            mDiskUtilization       = FindViewById <TextView>(Resource.Id.disk_utilization);
            mDiskAllowance         = FindViewById <TextView>(Resource.Id.disk_allowance);
            mAutoDownloadMimeTypes = FindViewById <TextView>(Resource.Id.auto_download_mime_types);
            mAvatar.Init(GetParticipantProvider(), GetPicasso());

            // Long-click copy-to-clipboard
            mUserName.SetOnLongClickListener(this);
            mUserState.SetOnLongClickListener(this);
            mAppVersion.SetOnLongClickListener(this);
            mAndroidVersion.SetOnLongClickListener(this);
            mAtlasVersion.SetOnLongClickListener(this);
            mLayerVersion.SetOnLongClickListener(this);
            mUserId.SetOnLongClickListener(this);
            mConversationCount.SetOnLongClickListener(this);
            mMessageCount.SetOnLongClickListener(this);
            mUnreadMessageCount.SetOnLongClickListener(this);
            mDiskUtilization.SetOnLongClickListener(this);
            mDiskAllowance.SetOnLongClickListener(this);
            mAutoDownloadMimeTypes.SetOnLongClickListener(this);

            // Buttons and switches
            mLogoutButton.Click += (sender, args) =>
            {
                SetEnabled(false);
                new AlertDialog.Builder(this)
                .SetCancelable(false)
                .SetMessage(Resource.String.alert_message_logout)
                .SetPositiveButton(Resource.String.alert_button_logout, (sender_, args_) =>
                {
                    if (Util.Log.IsLoggable(Util.Log.VERBOSE))
                    {
                        Util.Log.v("Deauthenticating");
                    }
                    ((IDialogInterface)sender_).Dismiss();
                    ProgressDialog progressDialog = new ProgressDialog(this);
                    progressDialog.SetMessage(Resources.GetString(Resource.String.alert_dialog_logout));
                    progressDialog.SetCancelable(false);
                    progressDialog.Show();
                    App.Deauthenticate(new AtlasUtilDeauthenticationCallback(this, progressDialog));
                })
                .SetNegativeButton(Resource.String.alert_button_cancel, (sender_, args_) =>
                {
                    ((IDialogInterface)sender_).Dismiss();
                    SetEnabled(true);
                })
                .Show();
            };

            mShowNotifications.CheckedChange += (sender, args) =>
            {
                PushNotificationReceiver.GetNotifications(this).SetEnabled(args.IsChecked);
            };

            mVerboseLogging.CheckedChange += (sender, args) =>
            {
                LayerClient.SetLoggingEnabled(this, args.IsChecked);
                Atlas.Util.Log.SetAlwaysLoggable(args.IsChecked);
                Util.Log.SetAlwaysLoggable(args.IsChecked);
            };
        }