示例#1
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetToolBarNavBack();
            StatusBarUtil.SetColorStatusBars(this);
            SetToolBarTitle(Resources.GetString(Resource.String.myStatus));
            //ÏÔʾͼƬÅäÖÃ
            options = new DisplayImageOptions.Builder()
                      .ShowImageForEmptyUri(Resource.Drawable.icon_yuanyou)
                      .ShowImageOnFail(Resource.Drawable.icon_yuanyou)
                      .ShowImageOnLoading(Resource.Drawable.icon_user)
                      .CacheInMemory(true)
                      .BitmapConfig(Bitmap.Config.Rgb565)
                      .CacheOnDisk(true)
                      // .Displayer(new DisplayerImageCircle(20))
                      .Build();
            _viewPager = FindViewById <ViewPager>(Resource.Id.viewPager_home);
            _tab       = FindViewById <TabLayout>(Resource.Id.tab_home);
            string[] myQuestionTabs = Resources.GetStringArray(Resource.Array.MyQuestionTabs);
            adapter = new QuestionTabFragmentAdapter(SupportFragmentManager, myQuestionTabs, true);

            _viewPager.Adapter            = adapter;
            _viewPager.OffscreenPageLimit = myQuestionTabs.Length;
            _tab.TabMode = TabLayout.ModeFixed;
            _tab.SetupWithViewPager(_viewPager);
            _tab.SetOnTabSelectedListener(this);
        }
示例#2
0
        private int photoEnterIndex; //´«ÈëµÄͼƬindex
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.Photo);
            viewPager_Img = FindViewById <ViewPager>(Resource.Id.viewpager_img);
            tv_index      = FindViewById <TextView>(Resource.Id.tv_index);
            //ÏÔʾͼƬÅäÖÃ
            options = new DisplayImageOptions.Builder()
                      .ShowImageForEmptyUri(Resource.Drawable.Icon)
                      .CacheInMemory(true)
                      .BitmapConfig(Android.Graphics.Bitmap.Config.Rgb565)
                      .ShowImageOnFail(Resource.Drawable.noavatar)
                      .ShowImageOnLoading(Resource.Drawable.icon_loading)
                      .CacheOnDisk(true)
                      .Build();

            List <string> urls = Intent.GetStringArrayExtra("urls").ToList();

            photoEnterIndex = Intent.GetIntExtra("index", -1);
            urls.RemoveAt(urls.Count - 1);
            photoCount = urls.Count;

            viewPager_Img.OffscreenPageLimit = photoCount;
            photoAdapter            = new Adapter.PhotoAdapter(urls);
            photoAdapter.LoadPhoto += (photoview, position) =>
            {
                System.Diagnostics.Debug.Write(urls[position]);
                ImageLoader.Instance.DisplayImage(urls[position], photoview, options);
            };
            viewPager_Img.Adapter = photoAdapter;
            viewPager_Img.AddOnPageChangeListener(this);
            viewPager_Img.SetCurrentItem(photoEnterIndex, false);
            tv_index.Text = $"{photoEnterIndex+1}/{photoCount}";
            // Create your application here
        }
示例#3
0
        public static void SetImageOption()
        {
            try
            {
                DefaultOptions = new DisplayImageOptions.Builder()
                                 .ShowImageOnLoading(Resource.Drawable.no_profile_image)   // resource or drawable
                                 .ShowImageForEmptyUri(Resource.Drawable.no_profile_image) // empty
                                 .ShowImageOnFail(Resource.Drawable.no_profile_image)      // error
                                 .CacheInMemory(true)

                                 .CacheOnDisk(true)
                                 .ConsiderExifParams(true)
                                 .Displayer(new FadeInBitmapDisplayer(200))

                                 .BitmapConfig(Bitmap.Config.Rgb565)
                                 .ImageScaleType(ImageScaleType.Exactly)
                                 .Build();

                CircleOptions = new DisplayImageOptions.Builder()

                                .CacheInMemory(true)
                                .CacheOnDisk(true)
                                .ConsiderExifParams(true)

                                .BitmapConfig(Bitmap.Config.Rgb565)
                                .Displayer(new RoundedBitmapDisplayer(1000))
                                .ImageScaleType(ImageScaleType.Exactly)
                                .Build();
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
        protected override async void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            answerId   = Intent.GetIntExtra("answerId", 0);
            questionId = Intent.GetIntExtra("questionId", 0);
            SetToolBarNavBack();
            StatusBarUtil.SetColorStatusBars(this);
            SetToolBarTitle("»Ø´ðÆÀÂÛ");
            //ÏÔʾͼƬÅäÖÃ
            options = new DisplayImageOptions.Builder()
                      .ShowImageForEmptyUri(Resource.Drawable.icon_yuanyou)
                      .ShowImageOnFail(Resource.Drawable.icon_yuanyou)
                      .ShowImageOnLoading(Resource.Drawable.icon_user)
                      .CacheInMemory(true)
                      .BitmapConfig(Bitmap.Config.Rgb565)
                      .CacheOnDisk(true)
                      // .Displayer(new DisplayerImageCircle(20))
                      .Build();
            edit_content = FindViewById <EditText>(Resource.Id.edit_content);
            btn_submit   = FindViewById <Button>(Resource.Id.btn_submit);
            userToken    = UserTokenUtil.GetToken(this);
            //btn_submit.enabvle
            btn_submit.Click += (s, e) =>
            {
                Add();
            };
            edit_content.TextChanged += (s, e) =>
            {
                string temp = edit_content.Text.TrimStart().TrimEnd();
                if (!string.IsNullOrEmpty(temp))
                {
                    btn_submit.Enabled = true;
                    if (atUserName != null && atUserName.Length > 0 && temp.Contains(atUserName))
                    {
                        isAt = true;
                    }
                    else
                    {
                        isAt = false;
                    }
                }
                else
                {
                    btn_submit.Enabled = false;
                }
            };

            _swipeRefreshLayout = FindViewById <SwipeRefreshLayout>(Resource.Id.swipeRefreshLayout);
            _swipeRefreshLayout.SetColorSchemeResources(Resource.Color.primary);
            _swipeRefreshLayout.SetOnRefreshListener(this);
            _swipeRefreshLayout.Post(() =>
            {
                _swipeRefreshLayout.Refreshing = true;
            });
            _recyclerView = FindViewById <RecyclerView>(Resource.Id.recyclerView);
            _recyclerView.SetLayoutManager(new Android.Support.V7.Widget.LinearLayoutManager(this));
            _recyclerView.AddItemDecoration(new RecyclerViewDecoration(this, (int)Orientation.Vertical));
            initRecyclerView();
            userInfo = UserInfoShared.GetUserInfo(this);
        }
        protected override async void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            // Create your application here
            StatusBarUtil.SetColorStatusBars(this);
            ImageLoaderConfiguration configuration = new ImageLoaderConfiguration.Builder(this).WriteDebugLogs().Build();//³õʼ»¯Í¼Æ¬¼ÓÔØ¿ò¼Ü

            ImageLoader.Instance.Init(configuration);
            //ÏÔʾͼƬÅäÖÃ
            options = new DisplayImageOptions.Builder()
                      .ShowImageForEmptyUri(Resource.Drawable.icon_yuanyou)
                      .ShowImageOnFail(Resource.Drawable.icon_yuanyou)
                      .ShowImageOnLoading(Resource.Drawable.icon_user)
                      .CacheInMemory(true)
                      .BitmapConfig(Bitmap.Config.Rgb565)
                      .CacheOnDisk(true)
                      // .Displayer(new DisplayerImageCircle(20))
                      .Build();
            SetToolBarNavBack();
            _swipeRefreshLayout = FindViewById <SwipeRefreshLayout>(Resource.Id.swipeRefreshLayout);
            _swipeRefreshLayout.SetColorScheme(Resource.Color.primary);
            tv_dateAdded       = FindViewById <TextView>(Resource.Id.tv_dateAdded);
            tv_userDisplayName = FindViewById <TextView>(Resource.Id.tv_userDisplayName);
            iv_userIcon        = FindViewById <ImageView>(Resource.Id.iv_userIcon);
            tv_content         = FindViewById <TextView>(Resource.Id.tv_content);
            edit_content       = FindViewById <EditText>(Resource.Id.edit_content);
            btn_submit         = FindViewById <Button>(Resource.Id.btn_submit);
            btn_submit.Click  += AddCommentClick;
            statusId           = Intent.GetIntExtra("id", 0);
            GetClientStatus(statusId);
            shareWidget   = new UMengShareWidget(this);
            _recyclerView = FindViewById <RecyclerView>(Resource.Id.recyclerView);
            _recyclerView.SetLayoutManager(new LinearLayoutManager(this));


            _swipeRefreshLayout.Post(() => {
                _swipeRefreshLayout.Refreshing = true;
            });
            _swipeRefreshLayout.Refresh += async(s, e) =>
            {
                await StatusService.ListStatusComment(AccessTokenUtil.GetToken(this), statusId, callBackSuccess, callBackError);
            };
            edit_content.TextChanged += (s, e) =>
            {
                if (string.IsNullOrEmpty(edit_content.Text.Trim()))
                {
                    btn_submit.Enabled = false;
                }
                else
                {
                    btn_submit.Enabled = true;
                }
            };
            AlertUtil.ToastShort(this, "Ïß³ÌID" + System.Threading.Thread.CurrentThread.ManagedThreadId.ToString());
            await StatusService.ListStatusComment(AccessTokenUtil.GetToken(this), statusId, callBackSuccess, callBackError);

            _recyclerView.AddItemDecoration(new RecyclerViewDecoration(this, (int)Orientation.Vertical));
        }
示例#6
0
        protected override async void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            POSTID = Intent.GetIntExtra("postId", 0);
            SetToolBarNavBack();
            StatusBarUtil.SetColorStatusBars(this);
            SetToolBarTitle(Resources.GetString(Resource.String.comment));
            //显示图片配置
            options = new DisplayImageOptions.Builder()
                      .ShowImageForEmptyUri(Resource.Drawable.icon_yuanyou)
                      .ShowImageOnFail(Resource.Drawable.icon_yuanyou)
                      .ShowImageOnLoading(Resource.Drawable.icon_user)
                      .CacheInMemory(true)
                      .BitmapConfig(Bitmap.Config.Rgb565)
                      .CacheOnDisk(true)
                      // .Displayer(new DisplayerImageCircle(20))
                      .Build();

            edit_content = FindViewById <EditText>(Resource.Id.edit_content);
            btn_submit   = FindViewById <Button>(Resource.Id.btn_submit);
            //btn_submit.enabvle
            btn_submit.Click += (s, e) =>
            {
                Add();
            };
            edit_content.TextChanged += (s, e) =>
            {
                string temp = edit_content.Text.TrimStart().TrimEnd();
                if (!string.IsNullOrEmpty(temp))
                {
                    btn_submit.Enabled = true;
                    if (atUserName != null && atUserName.Length > 0 && temp.Contains(atUserName))
                    {
                        isAt = true;
                    }
                    else
                    {
                        isAt = false;
                    }
                }
                else
                {
                    btn_submit.Enabled = false;
                }
            };

            _swipeRefreshLayout = FindViewById <SwipeRefreshLayout>(Resource.Id.swipeRefreshLayout);
            _swipeRefreshLayout.SetColorSchemeResources(Resource.Color.primary);
            _swipeRefreshLayout.SetOnRefreshListener(this);

            _recyclerView = FindViewById <RecyclerView>(Resource.Id.recyclerView);
            _recyclerView.SetLayoutManager(new Android.Support.V7.Widget.LinearLayoutManager(this));
            _recyclerView.AddItemDecoration(new RecyclerViewDecoration(this, (int)Orientation.Vertical));
            System.Diagnostics.Debug.Write("主线程ID" + Thread.CurrentThread.ManagedThreadId);
            accessToken = AccessTokenUtil.GetToken(this);
            OnRefresh();
        }
示例#7
0
 public BlogAdapter() : base(Resource.Layout.item_blog)
 {
     options = new DisplayImageOptions.Builder()
               .ShowImageForEmptyUri(Resource.Mipmap.ic_avatar_default)
               .ShowImageOnFail(Resource.Mipmap.ic_avatar_default)
               .ShowImageOnLoading(Resource.Mipmap.ic_avatar_default)
               .CacheInMemory(true)
               .BitmapConfig(Bitmap.Config.Rgb565)
               .CacheOnDisk(true).Build();
 }
示例#8
0
 public EventAdapter(List <EventList> list, Activity CurrentActivity)
 {
     mList       = list;
     activity    = CurrentActivity;
     imageLoader = ImageLoader.Instance;
     imageLoader.Init(ImageLoaderConfiguration.CreateDefault(activity));
     options = new DisplayImageOptions.Builder()
               .CacheInMemory(true)
               .CacheOnDisk(true).Build();
 }
 private void bindControls()
 {
     BlogApplication.InitImageLoader(this);
     imgLoader           = ImageLoader.Instance;
     displayImageOptions = new DisplayImageOptions.Builder()
                           .ShowImageForEmptyUri(Resource.Drawable.girl)
                           .ShowImageOnFail(Resource.Drawable.girl)
                           .ShowImageOnLoading(Resource.Drawable.girl)
                           .CacheInMemory(true)
                           .CacheOnDisk(true)
                           .ResetViewBeforeLoading()
                           .Build();
     btnBack        = FindViewById <Button>(Resource.Id.title_bar_back);
     btnBack.Click += delegate { Finish(); };
     textName       = FindViewById <TextView>(Resource.Id.text_nickname);
     textAge        = FindViewById <TextView>(Resource.Id.text_age);
     myBlog         = FindViewById <LinearLayout>(Resource.Id.my_blog);
     myBlog.Click  += delegate
     {
         if (CommonHelper.userInfo == null)
         {
             Msg.AppMsg.MakeText(this, "请先登录", Msg.AppMsg.STYLE_INFO).Show();
             return;
         }
         StartActivity(new Intent(this, typeof(MyPostsActivity)));
     };
     myCollect        = FindViewById <LinearLayout>(Resource.Id.my_collect);
     myCollect.Click += delegate
     {
         if (CommonHelper.userInfo == null)
         {
             Msg.AppMsg.MakeText(this, "请先登录", Msg.AppMsg.STYLE_INFO).Show();
             return;
         }
         StartActivity(new Intent(this, typeof(BookMarksActivity)));
     };
     setting        = FindViewById <LinearLayout>(Resource.Id.setting);
     setting.Click += delegate
     {
         AlertDialog.Builder builder = new AlertDialog.Builder(this);
         builder.SetMessage("APP作者:胡帅。一个不出名的帅小伙,只想安安静静写个代码。");
         builder.SetPositiveButton("我知道啦", (object sender, DialogClickEventArgs e) =>
         {
             AlertDialog dialog = sender as AlertDialog;
             dialog.Dismiss();
         });
         builder.SetTitle("提示");
         builder.Show();
     };
     btnLoginOut        = FindViewById <Button>(Resource.Id.btn_loginout);
     btnLoginOut.Click += btnLoginOut_Click;
     rImgView           = FindViewById <RoundImageView>(Resource.Id.img_headPic);
 }
示例#10
0
 protected void InitalComponents()
 {
     BlogApplication.InitImageLoader(this.Context);
     imgLoader           = ImageLoader.Instance;
     displayImageOptions = new DisplayImageOptions.Builder()
                           .ShowImageForEmptyUri(Resource.Drawable.girl)
                           .ShowImageOnFail(Resource.Drawable.girl)
                           .ShowImageOnLoading(Resource.Drawable.girl)
                           .CacheInMemory(true)
                           .CacheOnDisk(true)
                           .ResetViewBeforeLoading()
                           .Build();
 }
示例#11
0
            public ImageAdapter(Context context)
            {
                inflater = LayoutInflater.From(context);

                options = new DisplayImageOptions.Builder()
                          .ShowImageOnLoading(Resource.Drawable.ic_stub)
                          .ShowImageForEmptyUri(Resource.Drawable.ic_empty)
                          .ShowImageOnFail(Resource.Drawable.ic_error)
                          .CacheInMemory(true)
                          .CacheOnDisk(true)
                          .ConsiderExifParams(true)
                          .BitmapConfig(Bitmap.Config.Rgb565)
                          .Build();
            }
            public ImageAdapter(Context context)
            {
                inflater = LayoutInflater.From(context);

                options = new DisplayImageOptions.Builder()
                    .ShowImageOnLoading(Resource.Drawable.ic_stub)
                    .ShowImageForEmptyUri(Resource.Drawable.ic_empty)
                    .ShowImageOnFail(Resource.Drawable.ic_error)
                    .CacheInMemory(true)
                    .CacheOnDisk(true)
                    .ConsiderExifParams(true)
                    .Displayer(new RoundedBitmapDisplayer(20))
                    .Build();
            }
示例#13
0
            internal ImageAdapter(Context context)
            {
                inflater = LayoutInflater.From(context);

                options = new DisplayImageOptions.Builder()
                    .ShowImageForEmptyUri(Resource.Drawable.ic_empty)
                    .ShowImageOnFail(Resource.Drawable.ic_error)
                    .ResetViewBeforeLoading(true)
                    .CacheOnDisk(true)
                    .ImageScaleType(ImageScaleType.Exactly)
                    .BitmapConfig(Bitmap.Config.Rgb565)
                    .ConsiderExifParams(true)
                    .Displayer(new FadeInBitmapDisplayer(300))
                    .Build();
            }
示例#14
0
            public ImageAdapter(Activity c, List <Hit> pixabayResult)
            {
                _pixabayResult = pixabayResult;

                context = c;
                options = new DisplayImageOptions.Builder()
                          .ShowImageOnLoading(Resource.Drawable.ic_stub)
                          .ShowImageForEmptyUri(Resource.Drawable.ic_empty)
                          .ShowImageOnFail(Resource.Drawable.ic_error)
                          .CacheInMemory(false)
                          .CacheOnDisk(false)
                          .ConsiderExifParams(true)
                          .BitmapConfig(Bitmap.Config.Rgb565)
                          .Build();
            }
示例#15
0
 public override void OnCreate(Bundle savedInstanceState)
 {
     base.OnCreate(savedInstanceState);
     position = Arguments.GetInt("position");
     isMy     = Arguments.GetBoolean("isMy");
     //显示图片配置
     options = new DisplayImageOptions.Builder()
               .ShowImageForEmptyUri(Resource.Drawable.icon_yuanyou)
               .ShowImageOnFail(Resource.Drawable.icon_yuanyou)
               .ShowImageOnLoading(Resource.Drawable.icon_user)
               .CacheInMemory(true)
               .BitmapConfig(Bitmap.Config.Rgb565)
               .CacheOnDisk(true)
               .Build();
 }
示例#16
0
 public override void OnCreate(Bundle savedInstanceState)
 {
     base.OnCreate(savedInstanceState);
     position = Arguments.GetInt("position");
     //ÏÔʾͼƬÅäÖÃ
     options = new DisplayImageOptions.Builder()
               .ShowImageForEmptyUri(Resource.Drawable.icon_yuanyou)
               .ShowImageOnFail(Resource.Drawable.icon_yuanyou)
               .ShowImageOnLoading(Resource.Drawable.icon_user)
               .CacheInMemory(true)
               .BitmapConfig(Bitmap.Config.Rgb565)
               .CacheOnDisk(true)
               // .Displayer(new DisplayerImageCircle(20))
               .Build();
     accessToken = AccessTokenUtil.GetToken(this.Activity);
 }
示例#17
0
        public BaseHolder SetImageLoader(int viewId, DisplayImageOptions options, string url)
        {
            ImageView iv = GetView <ImageView>(viewId);

            //string url = iv.Tag.ToString();
            System.Diagnostics.Debug.Write("imgaeUrl", url);
            if (string.IsNullOrEmpty(url) || url.Length < 4 || !url.Substring(url.Length - 4, 4).Contains(".png"))
            {
                ImageLoader.Instance.DisplayImage("", iv, options);
            }
            else
            {
                ImageLoader.Instance.DisplayImage(url, iv, options);
            }
            return(this);
        }
示例#18
0
 protected void InitalComponents()
 {
     BlogApplication.InitImageLoader(this);
     imgLoader           = ImageLoader.Instance;
     displayImageOptions = new DisplayImageOptions.Builder()
                           .ShowImageForEmptyUri(Resource.Drawable.girl)
                           .ShowImageOnFail(Resource.Drawable.girl)
                           .ShowImageOnLoading(Resource.Drawable.girl)
                           .CacheInMemory(true)
                           .CacheOnDisk(true)
                           .ResetViewBeforeLoading()
                           .Build();
     btnBack        = FindViewById <Button>(Resource.Id.title_bar_back);
     btnBack.Click += delegate { Finish(); };
     textPageTitle  = FindViewById <TextView>(Resource.Id.head_title);
     ptrl           = FindViewById <PullToRefreshLayout>(Resource.Id.refresh_view);
     pListView      = FindViewById <PullableListView>(Resource.Id.pListView);
 }
示例#19
0
        private void InitImageLoader()
        {
            defaultOptions = new DisplayImageOptions.Builder()
                             .CacheOnDisk(true)
                             .CacheInMemory(true)
                             .ImageScaleType(ImageScaleType.ExactlyStretched)
                             .BitmapConfig(Bitmap.Config.Rgb565)
                             .ResetViewBeforeLoading(true)
                             .Build();

            ImageLoaderConfiguration.Builder builder =
                new ImageLoaderConfiguration.Builder(Application.Context).DefaultDisplayImageOptions(defaultOptions);

            ImageLoaderConfiguration config = builder.Build();

            imageLoader = ImageLoader.Instance;
            imageLoader.Init(config);
        }
        private void LoadNetImage()
        {
            ImageLoaderConfiguration config = new ImageLoaderConfiguration
                                              .Builder(this)
                                              .ThreadPriority(Thread.NormPriority - 2)
                                              .DenyCacheImageMultipleSizesInMemory()
                                              .MemoryCacheSize(2 * 1024 * 1024)
                                              .DefaultDisplayImageOptions(DisplayImageOptions.CreateSimple())
                                              .ImageDownloader(new BaseImageDownloader(this, 5 * 1000, 30 * 1000)) // connectTimeout (5 s), readTimeout (30 s)超时时间
                                              .WriteDebugLogs()                                                    // Remove for release app
                                              .Build();

            ImageLoader.Instance.Init(config);

            ImageLoader.Instance.DisplayImage(
                "drawable://" + Resource.Mipmap.lotus,
                new ImageView(this),
                new ImageLoadingListener(this));
        }
 public InventoryListViewAdapter(Activity context, int resource,
                                 IList <Tuple <string, string, string, string, Uri> > cars)
     : base(context, resource, Android.Resource.Id.Text1, cars)
 {
     _context = context;
     _cars    = cars;
     _options = new DisplayImageOptions.Builder()
                .ShowImageForEmptyUri(Resource.Drawable.car_placeholder)
                .ShowImageOnLoading(Resource.Drawable.car_placeholder)
                .ShowImageOnFail(Resource.Drawable.notification_template_icon_bg)
                .ResetViewBeforeLoading(true)
                .CacheOnDisk(true)
                .CacheInMemory(false)
                .ImageScaleType(ImageScaleType.Exactly)
                .BitmapConfig(Bitmap.Config.Rgb565)
                .ConsiderExifParams(false)
                .Displayer(new FadeInBitmapDisplayer(1000))
                .Build();
 }
示例#22
0
        public override async void OnViewCreated(View view, Bundle savedInstanceState)
        {
            //SetToolBarTitle(Resources.GetString(Resource.String.myBlog));
            //显示图片配置
            options = new DisplayImageOptions.Builder()
                      .ShowImageForEmptyUri(Resource.Drawable.icon_yuanyou)
                      .ShowImageOnFail(Resource.Drawable.icon_yuanyou)
                      .ShowImageOnLoading(Resource.Drawable.icon_user)
                      .CacheInMemory(true)
                      .BitmapConfig(Bitmap.Config.Rgb565)
                      .CacheOnDisk(true)
                      // .Displayer(new DisplayerImageCircle(20))
                      .Build();
            swipeRefreshLayout = View.FindViewById <SwipeRefreshLayout>(Resource.Id.swipeRefreshLayout);
            swipeRefreshLayout.SetColorSchemeColors(Resources.GetColor(Resource.Color.primary));
            swipeRefreshLayout.SetOnRefreshListener(this);
            tv_seniority    = View.FindViewById <TextView>(Resource.Id.tv_seniority);
            ly_unLogin      = View.FindViewById <LinearLayout>(Resource.Id.ly_unLogin);
            ly_logged       = View.FindViewById <LinearLayout>(Resource.Id.ly_logged);
            tv_subTitle     = View.FindViewById <TextView>(Resource.Id.tv_subTitle);
            tv_postCount    = View.FindViewById <TextView>(Resource.Id.tv_postCount);
            ll_blog         = View.FindViewById <LinearLayout>(Resource.Id.ll_blog);
            ll_status       = View.FindViewById <LinearLayout>(Resource.Id.ll_status);
            ll_question     = View.FindViewById <LinearLayout>(Resource.Id.ll_question);
            tv_myBookmark   = View.FindViewById <TextView>(Resource.Id.tv_myBookmark);
            tv_about        = view.FindViewById <TextView>(Resource.Id.tv_about);
            tv_about.Click += (s, e) =>
            {
                AboutActivity.Enter(Activity);
            };
            ly_unLogin.Click += (s, e) =>
            {
                StartActivity(new Intent(Activity, typeof(loginactivity)));
            };

            tv_userName   = View.FindViewById <TextView>(Resource.Id.tv_userName);
            iv_userAvatar = View.FindViewById <ImageView>(Resource.Id.iv_userAvatar);
            userToken     = UserTokenUtil.GetToken(Activity);
            OnRefresh();
            //用户token 未过期
        }
示例#23
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            SetContentView(Resource.Layout.Main);

            // set up the image loader
            imageLoader = ImageLoader.Instance;
            options = new DisplayImageOptions.Builder()
                .CacheInMemory(true)
                .Build();

            // to display a preview
            imageView = FindViewById<PhotoView>(Resource.Id.imageView);

            // create the Thumbor instance pointing to the Thumbor server
            thumbor = Thumbor.Create("http://thumbor.thumborize.me/");

            // give us an image to start off with
            GetImage(Resource.Id.resize, GetString(Resource.String.resize));
        }
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            SetContentView(Resource.Layout.Main);

            // set up the image loader
            imageLoader = ImageLoader.Instance;
            options     = new DisplayImageOptions.Builder()
                          .CacheInMemory(true)
                          .Build();

            // to display a preview
            imageView = FindViewById <PhotoView>(Resource.Id.imageView);

            // create the Thumbor instance pointing to the Thumbor server
            thumbor = Thumbor.Create("http://thumbor.thumborize.me/");

            // give us an image to start off with
            GetImage(Resource.Id.resize, GetString(Resource.String.resize));
        }
示例#25
0
        protected override async void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.activity_event_detail);
            eventId            = Intent.GetIntExtra("eventId", 0);
            _IEventListService = new EventListService();
            eventDetail        = new EventDetail();
            imageLoader        = ImageLoader.Instance;
            options            = new DisplayImageOptions.Builder()
                                 .CacheInMemory(true)
                                 .CacheOnDisk(true)
                                 .Build();
            imageLoader.Init(ImageLoaderConfiguration.CreateDefault(this));
            InitilizeView();
            eventDetail = await GetEventDetail();

            if (eventDetail != null)
            {
                setUIData();
            }
        }
示例#26
0
 private void bindControls()
 {
     imgLoader           = ImageLoader.Instance;
     displayImageOptions = new DisplayImageOptions.Builder()
                           .ShowImageForEmptyUri(Resource.Drawable.girl)
                           .ShowImageOnFail(Resource.Drawable.girl)
                           .ShowImageOnLoading(Resource.Drawable.girl)
                           .CacheInMemory(true)
                           .CacheOnDisk(true)
                           .ResetViewBeforeLoading()
                           .Build();
     FindViewById <TextView>(Resource.Id.head_title).Text = "博主搜索";
     btnBack         = FindViewById <Button>(Resource.Id.title_bar_back);
     btnBack.Click  += delegate { Finish(); };
     ibSearch        = FindViewById <ImageButton>(Resource.Id.ib_search);
     ibSearch.Click += delegate
     {
         string keyWord = textKeyWord.Text;
         if (string.IsNullOrWhiteSpace(keyWord))
         {
             return;
         }
         search(keyWord);
     };
     lvBloggers            = FindViewById <ListView>(Resource.Id.lv_blogger);
     lvBloggers.ItemClick += delegate(object sender, ListView.ItemClickEventArgs e)
     {
         Intent intent = new Intent(this, typeof(BloggerHomePageActivity));
         intent.PutExtra("blogger", JsonConvert.SerializeObject(bloggers[e.Position]));
         StartActivity(intent);
     };
     comAdaper            = new CommonAdapter <Blogger>(this, Resource.Layout.blogger_search_item, bloggers);
     comAdaper.OnGetView += comAdapter_OnGetView;
     lvBloggers.Adapter   = comAdaper;
     textKeyWord          = FindViewById <EditText>(Resource.Id.text_keyword);
 }
示例#27
0
        public static void SetImageOption()
        {
            DefaultOptions = new DisplayImageOptions.Builder()
                             .ShowImageOnLoading(Resource.Drawable.Grey_Offline)
                             .ShowImageForEmptyUri(Resource.Drawable.Grey_Offline)
                             .ShowImageOnFail(Resource.Drawable.ImagePlacholder)
                             .CacheInMemory(true)
                             .CacheOnDisk(true)
                             .ConsiderExifParams(true)
                             .Displayer(new FadeInBitmapDisplayer(500))
                             .ImageScaleType(ImageScaleType.Exactly)
                             .Build();

            CircleOptions = new DisplayImageOptions.Builder()
                            .ShowImageOnLoading(Resource.Drawable.Grey_Offline)
                            .ShowImageForEmptyUri(Resource.Drawable.Grey_Offline)
                            .ShowImageOnFail(Resource.Drawable.ImagePlacholder)
                            .CacheInMemory(true)
                            .CacheOnDisk(true)
                            .ConsiderExifParams(true)
                            .Displayer(new FadeInBitmapDisplayer(500)).Displayer(new CircleBitmapDisplayer())
                            .ImageScaleType(ImageScaleType.Exactly)
                            .Build();
        }
示例#28
0
        protected override async void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            // Create your application here
            StatusBarUtil.SetColorStatusBars(this);
            ImageLoaderConfiguration configuration = new ImageLoaderConfiguration.Builder(this).WriteDebugLogs().Build();//初始化图片加载框架

            ImageLoader.Instance.Init(configuration);
            //显示图片配置
            options = new DisplayImageOptions.Builder()
                      .ShowImageForEmptyUri(Resource.Drawable.icon_yuanyou)
                      .ShowImageOnFail(Resource.Drawable.icon_yuanyou)
                      .ShowImageOnLoading(Resource.Drawable.icon_user)
                      .CacheInMemory(true)
                      .BitmapConfig(Bitmap.Config.Rgb565)
                      .CacheOnDisk(true)
                      // .Displayer(new DisplayerImageCircle(20))
                      .Build();
            SetToolBarNavBack();
            tv_title        = FindViewById <TextView>(Resource.Id.tv_title);
            tv_award        = FindViewById <TextView>(Resource.Id.tv_award);
            tv_dateAdded    = FindViewById <TextView>(Resource.Id.tv_dateAdded);
            tv_userName     = FindViewById <TextView>(Resource.Id.tv_userName);
            iv_userIcon     = FindViewById <ImageView>(Resource.Id.iv_userIcon);
            tv_tags         = FindViewById <TextView>(Resource.Id.tv_tags);
            tv_dingCount    = FindViewById <TextView>(Resource.Id.tv_ding);
            tv_viewCount    = FindViewById <TextView>(Resource.Id.tv_view);
            tv_qScore       = FindViewById <TextView>(Resource.Id.tv_qScore);
            btn_answerCount = FindViewById <Button>(Resource.Id.btn_comment);
            btn_mark        = FindViewById <Button>(Resource.Id.btn_mark);

            tv_dealFlag = FindViewById <TextView>(Resource.Id.tv_dealFlag);
            wb_content  = FindViewById <WebView>(Resource.Id.wb_content);

            questionId = Intent.GetIntExtra("id", 0);
            GetClientQuestion(questionId);
            GetServerQuestion();
            shareWidget            = new UMengShareWidget(this);
            btn_answerCount.Click += (s, e) =>
            {
                QuestionAnswerActivity.Enter(this, questionId);
            };
            //_swipeRefreshLayout = FindViewById<SwipeRefreshLayout>(Resource.Id.swipeRefreshLayout);
            //_swipeRefreshLayout.SetColorSchemeResources(Resource.Color.primary);
            //_swipeRefreshLayout.SetOnRefreshListener(this);
            //_swipeRefreshLayout.Post(() =>
            //{
            //    _swipeRefreshLayout.Refreshing = true;

            //});

            wb_content.Settings.DomStorageEnabled       = true;
            wb_content.Settings.JavaScriptEnabled       = true;    //支持js
            wb_content.Settings.DefaultTextEncodingName = "utf-8"; //设置编码方式utf-8
            wb_content.Settings.SetSupportZoom(false);             //不可缩放
            wb_content.Settings.DisplayZoomControls = false;       //隐藏原生的缩放控件
            wb_content.Settings.BuiltInZoomControls = false;       //设置内置的缩放控件
            wb_content.Settings.CacheMode           = CacheModes.CacheElseNetwork;
            wb_content.ScrollBarStyle = ScrollbarStyles.InsideOverlay;
            wb_content.Settings.LoadsImagesAutomatically = true; //支持自动加载图片
            wb_content.Settings.UseWideViewPort          = true; //将图片调整到合适webview的大小
            wb_content.Settings.SetLayoutAlgorithm(WebSettings.LayoutAlgorithm.SingleColumn);
            var jsInterface = new WebViewJSInterface(this);

            wb_content.SetWebViewClient(ContentWebViewClient.Instance(this));
            wb_content.AddJavascriptInterface(jsInterface, "openlistner");
            jsInterface.CallFromPageReceived += delegate(object sender, WebViewJSInterface.CallFromPageReceivedEventArgs e)
            {
                PhotoActivity.Enter(this, e.Result.Split(','), e.Index);
            };
        }
示例#29
0
        protected override async void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            blogApp = Intent.GetStringExtra("blogApp");
            postId  = Intent.GetIntExtra("postId", 0);
            SetToolBarNavBack();
            StatusBarUtil.SetColorStatusBars(this);
            SetToolBarTitle(Resources.GetString(Resource.String.comment));
            //显示图片配置
            options = new DisplayImageOptions.Builder()
                      .ShowImageForEmptyUri(Resource.Drawable.icon_yuanyou)
                      .ShowImageOnFail(Resource.Drawable.icon_yuanyou)
                      .ShowImageOnLoading(Resource.Drawable.icon_user)
                      .CacheInMemory(true)
                      .BitmapConfig(Bitmap.Config.Rgb565)
                      .CacheOnDisk(true)
                      // .Displayer(new DisplayerImageCircle(20))
                      .Build();
            edit_content = FindViewById <EditText>(Resource.Id.edit_content);
            btn_submit   = FindViewById <Button>(Resource.Id.btn_submit);
            //btn_submit.enabvle
            btn_submit.Click += (s, e) =>
            {
                Add();
            };
            edit_content.TextChanged += (s, e) =>
            {
                string temp = edit_content.Text.TrimStart().TrimEnd();
                if (!string.IsNullOrEmpty(temp))
                {
                    btn_submit.Enabled = true;
                    if (atUserName != null && atUserName.Length > 0 && temp.Contains(atUserName))
                    {
                        isAt = true;
                    }
                    else
                    {
                        isAt = false;
                    }
                }
                else
                {
                    btn_submit.Enabled = false;
                }
            };

            _swipeRefreshLayout = FindViewById <SwipeRefreshLayout>(Resource.Id.swipeRefreshLayout);
            _swipeRefreshLayout.SetColorSchemeResources(Resource.Color.primary);
            _swipeRefreshLayout.SetOnRefreshListener(this);
            _swipeRefreshLayout.Post(() =>
            {
                _swipeRefreshLayout.Refreshing = true;
            });
            _swipeRefreshLayout.PostDelayed(() =>
            {
                System.Diagnostics.Debug.Write("PostDelayed方法已经完成");
                _swipeRefreshLayout.Refreshing = false;
            }, 3000);
            _recyclerView = FindViewById <RecyclerView>(Resource.Id.recyclerView);
            _recyclerView.SetLayoutManager(new Android.Support.V7.Widget.LinearLayoutManager(this));
            _recyclerView.AddItemDecoration(new RecyclerViewDecoration(this, (int)Orientation.Vertical));
            try
            {
                commentList = await listArticleCommentServer();

                if (commentList != null)
                {
                    initRecycler();
                }
            }
            catch (Exception ex)
            {
                MobclickAgent.ReportError(this, ex.ToString());
                System.Diagnostics.Debug.Write(ex.ToString());
            }
        }
示例#30
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            // Create your application here
            StatusBarUtil.SetColorStatusBars(this);
            ImageLoaderConfiguration configuration = new ImageLoaderConfiguration.Builder(this).WriteDebugLogs().Build();//初始化图片加载框架

            ImageLoader.Instance.Init(configuration);
            //显示图片配置
            options = new DisplayImageOptions.Builder()
                      .ShowImageForEmptyUri(Resource.Drawable.icon_yuanyou)
                      .ShowImageOnFail(Resource.Drawable.icon_yuanyou)
                      .ShowImageOnLoading(Resource.Drawable.icon_user)
                      .CacheInMemory(true)
                      .BitmapConfig(Bitmap.Config.Rgb565)
                      .CacheOnDisk(true)
                      // .Displayer(new DisplayerImageCircle(20))
                      .Build();
            SetToolBarNavBack();
            ID                 = Intent.GetIntExtra("id", 0);
            tv_author          = FindViewById <TextView>(Resource.Id.tv_author);
            tv_postDate        = FindViewById <TextView>(Resource.Id.tv_postDate);
            wb_content         = FindViewById <WebView>(Resource.Id.wb_content);
            iv_avatar          = FindViewById <ImageView>(Resource.Id.iv_avatar);
            tv_articleTitle    = FindViewById <TextView>(Resource.Id.tv_articleTitle);
            btn_comment        = FindViewById <Button>(Resource.Id.btn_comment);
            tv_ding            = FindViewById <TextView>(Resource.Id.tv_ding);
            btn_mark           = FindViewById <Button>(Resource.Id.btn_mark);
            tv_view            = FindViewById <TextView>(Resource.Id.tv_view);
            swipeRefreshLayout = FindViewById <SwipeRefreshLayout>(Resource.Id.swipeRefreshLayout);
            swipeRefreshLayout.SetColorSchemeColors(Resources.GetColor(Resource.Color.primary));
            swipeRefreshLayout.SetOnRefreshListener(this);
            btn_mark.Click += (s, e) =>
            {
                AddBookmarkActivity.Enter(this, article.Url, article.Title, "add");
            };

            btn_comment.Click += (s, e) =>
            {
                ArticleCommentActivity.Enter(this, article.BlogApp, ID);
            };
            wb_content.Settings.DomStorageEnabled       = true;
            wb_content.Settings.JavaScriptEnabled       = true;    //支持js
            wb_content.Settings.DefaultTextEncodingName = "utf-8"; //设置编码方式utf-8
            wb_content.Settings.SetSupportZoom(false);             //不可缩放
            wb_content.Settings.DisplayZoomControls = false;       //隐藏原生的缩放控件
            wb_content.Settings.BuiltInZoomControls = false;       //设置内置的缩放控件
            wb_content.Settings.CacheMode           = CacheModes.CacheElseNetwork;
            wb_content.ScrollBarStyle = ScrollbarStyles.InsideOverlay;
            wb_content.Settings.LoadsImagesAutomatically = true; //支持自动加载图片
            wb_content.Settings.UseWideViewPort          = true; //将图片调整到合适webview的大小
            wb_content.Settings.SetLayoutAlgorithm(WebSettings.LayoutAlgorithm.SingleColumn);
            var jsInterface = new  WebViewJSInterface(this);

            wb_content.SetWebViewClient(ContentWebViewClient.Instance(this));
            wb_content.AddJavascriptInterface(jsInterface, "openlistner");
            jsInterface.CallFromPageReceived += delegate(object sender, WebViewJSInterface.CallFromPageReceivedEventArgs e)
            {
                PhotoActivity.Enter(this, e.Result.Split(','), e.Index);
            };
            if (ID == 0)
            {
                Android.OS.Handler handle = new Android.OS.Handler();
                handle.PostDelayed(() =>
                {
                    Finish();
                }, 2000);
                AlertUtil.ToastShort(this, "获取id错误立即返回");
            }
            InitArticle();
            shareWidget = new UMengShareWidget(this);
        }
 static UILWidgetProvider()
 {
     displayOptions = DisplayImageOptions.CreateSimple();
 }
            public ImageAdapter(Context context)
            {
                inflater = LayoutInflater.From(context);

                options = new DisplayImageOptions.Builder()
                        .ShowImageForEmptyUri(Resource.Drawable.ic_empty)
                        .ShowImageOnFail(Resource.Drawable.ic_error)
                        .ResetViewBeforeLoading(true)
                        .CacheOnDisk(true)
                        .ImageScaleType(ImageScaleType.Exactly)
                        .BitmapConfig(Bitmap.Config.Rgb565)
                        .ConsiderExifParams(true)
                        .Displayer(new FadeInBitmapDisplayer(300))
                        .Build();
            }
示例#33
0
        public async Task <Bitmap> LoadImageAsync(CancellationToken ct, string uri, ImageView imageView, Size?targetSize,
                                                  DisplayImageOptions options)
        {
            try
            {
                for (var retryNo = 0; retryNo < 12; retryNo++)
                {
                    Task          taskToWait;
                    Task <Bitmap> taskToRun = null;

                    lock (CurrentRequestForUri)
                    {
                        // Any other concurrent request to this uri?
                        if (!CurrentRequestForUri.TryGetValue(uri, out taskToWait))                         // yes: we assign it to the variable.
                        {
                            // Nope, we're the only one (or first one), we create
                            // a semaphore others will wait on.
                            taskToRun = InnerLoadImageAsync(ct, uri, imageView, targetSize, options);
                            CurrentRequestForUri[uri] = taskToRun;
                        }
                    }

                    if (taskToRun != null)
                    {
                        return(await taskToRun);
                    }
                    else if (taskToWait != null)
                    {
                        try
                        {
                            await taskToWait;                             // wait for other before retrying
                        }
                        catch (Exception)
                        {
                            if (ct.IsCancellationRequested)
                            {
                                throw;
                            }
                            // else retry the current request
                        }

                        if (retryNo > 1)
                        {
                            // After 1st retry, wait for others to execute before retrying to
                            // minimize competing tasks issues.
                            await Task.Delay(retryNo * 5, ct);
                        }
                    }
                }

                throw new InvalidOperationException("Retry count exceed.");
            }
            finally
            {
                lock (CurrentRequestForUri)
                {
                    // Remove waiting entry in dictionary
                    CurrentRequestForUri.Remove(uri);
                }
            }
        }
示例#34
0
        private static async Task <Bitmap> InnerLoadImageAsync(CancellationToken ct, string uri, ImageView imageView, Size?targetSize, DisplayImageOptions options)
        {
            TaskCompletionSource <Bitmap> source = new TaskCompletionSource <Bitmap>();


            options = options ?? new DisplayImageOptions.Builder()
                      .CacheInMemory(true)
                      .CacheOnDisk(true)
                      .Build();

            // Propagate cancellation to the managed TCS, even though we don't propagate it to Universal Image Loader. This is because UIL has
            // the air of cancelling downloads itself if another uri is requested for the same ImageView, leading us to wait on a task that
            // will never complete (thanks to the concurrency logic reusing existing tasks).
            using (ct.Register(() => source.TrySetCanceled()))
            {
                using (var aware =
                           imageView != null
                                                ? new ImageViewAwareCancellable(imageView, ct)
                                                : null
                       )
                {
                    using (var listener = new ImageListener(source))
                    {
                        if (targetSize != null && imageView != null)
                        {
                            imageView.SetMaxHeight(targetSize.Value.Height);
                            imageView.SetMaxWidth(targetSize.Value.Width);

                            ImageLoader.Instance.DisplayImage(
                                uri,
                                aware,
                                options,
                                listener
                                );
                        }
                        else if (targetSize != null && imageView == null)
                        {
                            var targetImageSize = new ImageSize(targetSize.Value.Width, targetSize.Value.Height);

                            ImageLoader.Instance.LoadImage(
                                uri,
                                targetImageSize,
                                options,
                                listener
                                );
                        }
                        else
                        {
                            ImageLoader.Instance.LoadImage(
                                uri,
                                options,
                                listener
                                );
                        }

                        var target = await source.Task;

                        return(target);
                    }
                }
            }
        }