Beispiel #1
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            SetContentView(Resource.Layout.settings_activity);
            extras     = Intent.Extras;
            parcelable = (ProfileParcelable)extras.GetParcelable(Constants.PROFILE_DATA_EXTRA);

            username_tv = FindViewById <TextView>(Resource.Id.set_prof_name_tv);
            status_tv   = FindViewById <TextView>(Resource.Id.set_prof_extras_tv);
            var appBar  = FindViewById <AppBarLayout>(Resource.Id.settings_appbar);
            var toolbar = appBar.FindViewById <Toolbar>(Resource.Id.main_toolbar);

            profileConstraint = FindViewById <ConstraintLayout>(Resource.Id.profile_const);
            profileIv         = FindViewById <CircleImageView>(Resource.Id.set_prof_iv);

            toolbar.Title = "Settings";
            SetSupportActionBar(toolbar);
            SupportActionBar.SetDisplayHomeAsUpEnabled(true);
            toolbar.NavigationClick += Toolbar_NavigationClick;
            SupportFragmentManager.BeginTransaction()
            .Replace(Resource.Id.frag_container_s, new SettingsFragment())
            .CommitAllowingStateLoss();

            var prefs = PreferenceManager.GetDefaultSharedPreferences(this);

            prefs.RegisterOnSharedPreferenceChangeListener(this);
            var isOnline = prefs.GetBoolean(Constants.SWITCH_VALUE_EXTRA, false);

            SetOnlineStatus(isOnline);

            profileConstraint.Click += ProfileConstraint_Click;

            RequestOptions requestOptions = new RequestOptions();

            requestOptions.Placeholder(Resource.Drawable.user);

            imgUrl   = parcelable.UserProfile.ProfileImgUrl;
            username = parcelable.UserProfile.Username;
            phone    = parcelable.UserProfile.Phone;
            email    = parcelable.UserProfile.Email;
            status   = parcelable.UserProfile.Status;
            userPro  = new string[] { imgUrl, username, phone, status };

            Glide.With(this)
            .SetDefaultRequestOptions(requestOptions)
            .Load(imgUrl)
            .Into(profileIv);

            username_tv.Text = username;
            status_tv.Text   = status;
        }
        private void ProfileImageView_Click(object sender, EventArgs e)
        {
            var intent = new Intent(this, typeof(FullscreenImageActivity));
            var pp     = new ProfileParcelable();

            pp.UserProfile = user;
            intent.PutExtra(Constants.TRANSITION_NAME, ViewCompat.GetTransitionName(profileImageView));
            intent.PutExtra(Constants.PROFILE_DATA_EXTRA, pp);
            intent.PutExtra(Constants.PARCEL_TYPE, 1);
            var options = ActivityOptionsCompat.MakeSceneTransitionAnimation(this, profileImageView,
                                                                             ViewCompat.GetTransitionName(profileImageView));

            StartActivity(intent, options.ToBundle());
        }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.fullscreen_imageviewer);
            imageView   = (ImageView)FindViewById(Resource.Id.image);
            fullToolbar = (Toolbar)FindViewById(Resource.Id.fullscreen_toolbar);
            SetSupportActionBar(fullToolbar);
            SupportActionBar.SetDisplayHomeAsUpEnabled(true);

            var loupe = new Loupe(imageView);

            loupe.UseDismissAnimation     = false;
            loupe.OnViewTranslateListener = new OnViewTranslateListener((v1) =>
            {
                SupportFinishAfterTransition();
            }, null, null, null);

            try
            {
                Bundle extras = Intent.Extras;
                int    type   = extras.GetInt(Constants.PARCEL_TYPE);
                switch (type)
                {
                case 0:
                    PostParcelable postParcel = (PostParcelable)extras.GetParcelable(Constants.POST_DATA_EXTRA);
                    Glide.With(this).Load(postParcel.PostItem.DownloadUrl).Into(imageView);
                    break;

                default:
                    ProfileParcelable profileParcel = (ProfileParcelable)extras.GetParcelable(Constants.PROFILE_DATA_EXTRA);
                    Glide.With(this).Load(profileParcel.UserProfile.ProfileImgUrl).Into(imageView);
                    break;
                }
                string imageTransitionName = extras.GetString(Constants.TRANSITION_NAME);
                imageView.TransitionName = imageTransitionName;
            }
            catch (Exception e)
            {
                Toast.MakeText(this, e.Message, ToastLength.Short).Show();
            }
        }