예제 #1
0
        protected override Android.Graphics.Bitmap RunInBackground(params Profile[] @params)
        {
            String imageUrl        = @params[0].imageUri;
            String userId          = @params[0].ID;
            Bitmap image           = null;
            bool   AvatarIsDefault = @params[0].AvatarIsDefault;

            if (imageUrl == null)
            {
                return(null);
            }

            try
            {
                byte[] data = OperationWithBitmap.Retrieve(context, userId);

                if (data == null)
                {
                    image = OperationWithBitmap.GetFromUrl(imageUrl);
                    var bitmapData = OperationWithBitmap.ConvertToByteArray(image);
                    OperationWithBitmap.Cache(context, bitmapData, userId);
                }
                else
                {
                    image = OperationWithBitmap.ConvertFromByteArray(data);
                }
            }
            catch (Exception e) { Console.Out.WriteLine(e.Message); }

            return(image);
        }
예제 #2
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            FrameLayout ProfileLayout = new FrameLayout(this);

            SetContentView(ProfileLayout);
            base.CombineWith(ProfileLayout, Resource.Layout.Profile, ActivityIs.Profile);

            MainToolbar = FindViewById <SupportToolBar>(Resource.Id.toolbar);
            EditName    = FindViewById <EditText>(Resource.Id.EditProfileUserName);
            SwitchState = FindViewById <TextView>(Resource.Id.SwitchStateText);

            NotificationSwitch = FindViewById <Switch>(Resource.Id.SwitchEmailNotifications);
            UserAvatar         = FindViewById <CircularImageView>(Resource.Id.UserAvatar);
            UserName           = FindViewById <TextView>(Resource.Id.ProfileUserName);
            UserEmail          = FindViewById <TextView>(Resource.Id.ProfileUserEmail);

            InitializeProfile();

            MainToolbar.InflateMenu(Resource.Menu.profile_top_menu);
            MainToolbar.Title = "Profile";

            NotificationSwitch.Visibility = ViewStates.Invisible;
            EditName.Visibility           = ViewStates.Invisible;
            SetSwitchState();

            MainToolbar.MenuItemClick += MainToolbar_MenuItemClick;
            UserAvatar.Click          += UserAvatar_Click;
        }
예제 #3
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            FrameLayout MainLayout = new FrameLayout(this);

            SetContentView(MainLayout);
            base.CombineWith(MainLayout, Resource.Layout.Main, ActivityIs.Home);

            MainToolbar     = FindViewById <SupportToolBar>(Resource.Id.toolbar);
            SayThanksButton = FindViewById <Button>(Resource.Id.thanksButton);
            UserAvatar      = FindViewById <CircularImageView>(Resource.Id.UserAvatar);
            UserName        = FindViewById <TextView>(Resource.Id.UserName);
            UserEmail       = FindViewById <TextView>(Resource.Id.UserEmail);
            Balance         = FindViewById <TextView>(Resource.Id.ABpoints);
            Rewards         = FindViewById <TextView>(Resource.Id.Rpoints);
            Distribute      = FindViewById <TextView>(Resource.Id.CDpoints);
            RefreshInfo     = FindViewById <SwipeRefreshLayout>(Resource.Id.activity_main_swipe_refresh_layout);

            ABPointstext = FindViewById <TextView>(Resource.Id.ABpointsText);
            RPointstext  = FindViewById <TextView>(Resource.Id.RpointsText);
            CDPointstext = FindViewById <TextView>(Resource.Id.CDpointsText);

            ISharedPreferences info = Application.Context.GetSharedPreferences(GetString(Resource.String.ApplicationInfo), FileCreationMode.Private);

            Loggedin = info.GetBoolean(GetString(Resource.String.LogIn), false);

            if (!Loggedin)
            {
                Intent LogInIntent = new Intent(this, typeof(LogInActivity));
                LogInIntent.AddFlags(ActivityFlags.NoAnimation);
                this.StartActivityForResult(LogInIntent, LOG_IN_REQUEST);
                OverridePendingTransition(0, 0);
            }
            else
            {
                InitializeProfile();
            }

            CorrectPointsText();

            if (Android.OS.Build.VERSION.SdkInt >= BuildVersionCodes.Lollipop)
            {
                SayThanksButton.SetBackgroundResource(Resource.Color.button_ripple);
            }

            MainToolbar.InflateMenu(Resource.Menu.top_menu);
            MainToolbar.SetLogo(Resource.Drawable.ic_cloud_queue_white_24dp);
            MainToolbar.Title            = "Merit Money";
            MainToolbar.TitleMarginStart = AdditionalFunctions.ConvertDpToPx(40);

            SayThanksButton.Click     += SayThanksButton_Click;
            MainToolbar.MenuItemClick += MainToolbar_MenuItemClick;
            RefreshInfo.Refresh       += Profile_Refresh;
        }
예제 #4
0
        public override SupportRecyclerView.ViewHolder OnCreateViewHolder(ViewGroup parent, int viewType)
        {
            View item = LayoutInflater.From(parent.Context).Inflate(Resource.Layout.search_list_item, parent, false);

            TextView          itemName   = item.FindViewById <TextView>(Resource.Id.searchName);
            TextView          itemEmail  = item.FindViewById <TextView>(Resource.Id.searchEmail);
            CircularImageView itemAvatar = item.FindViewById <CircularImageView>(Resource.Id.searchAvatar);

            ListViewHolder view = new ListViewHolder(item, activity, MeritMoneyUsers)
            {
                Name = itemName, Email = itemEmail, Avatar = itemAvatar
            };

            return(view);
        }
예제 #5
0
            public HistoryViewHolder(View view, Context context, HistoryList history, String LastDate) : base(view)
            {
                MainView      = view;
                this.History  = history;
                this.context  = context;
                this.LastDate = LastDate;

                TextView          itemDate      = view.FindViewById <TextView>(Resource.Id.historyDate);
                TextView          itemMessage   = view.FindViewById <TextView>(Resource.Id.historyName);
                TextView          itemComment   = view.FindViewById <TextView>(Resource.Id.historyReason);
                CircularImageView itemAvatar    = view.FindViewById <CircularImageView>(Resource.Id.searchAvatar);
                ImageView         itemIndicator = view.FindViewById <ImageView>(Resource.Id.history_indicator);

                itemIndicator.Visibility = ViewStates.Invisible;

                date      = itemDate;
                message   = itemMessage;
                Avatar    = itemAvatar;
                Indicator = itemIndicator;
                comment   = itemComment;
            }
예제 #6
0
 public CacheUserAvatar(CircularImageView image, Context context)
 {
     this.image   = image;
     this.context = context;
 }
예제 #7
0
 public UploadAvatarOnServer(CircularImageView image)
 {
     this.image = image;
     UserId     = db.GetProfile().ID;
 }