Exemple #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);
        }
Exemple #2
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            try
            {
                base.OnCreate(savedInstanceState);
                StatusBarUtil.SetColorStatusBars(this);

                SetContentView(LayoutResourceId);
                toolbar = FindViewById <Toolbar>(Resource.Id.toolbar);
                if (toolbar != null)
                {
                    SetSupportActionBar(toolbar);
                    SupportActionBar.Title = ToolBarTitle;
                    toolbar.SetOnMenuItemClickListener(this);
                }
                if (application == null)
                {
                    application = (InitApp)ApplicationContext;
                }
            }
            catch (Exception ex)
            {
            }
            // Create your application here
        }
        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));
        }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            // Create your application here
            StatusBarUtil.SetColorStatusBars(this);
            SetToolBarNavBack();
            shareWidget        = new UMengShareWidget(this);
            wb_content         = FindViewById <WebView>(Resource.Id.wb_content);
            tv_ding            = FindViewById <TextView>(Resource.Id.tv_ding);
            btn_mark           = FindViewById <Button>(Resource.Id.btn_mark);
            btn_comment        = FindViewById <Button>(Resource.Id.btn_comment);
            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, string.Format(Constact.KbPage, ID), news.Title, "add");
            };
            btn_comment.Click += (s, e) =>
            {
                NewsCommentActivity.Enter(this, 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);
            };
            ID = Intent.GetIntExtra("id", 0);
            if (ID == 0)
            {
                Android.OS.Handler handle = new Android.OS.Handler();
                handle.PostDelayed(() =>
                {
                    Finish();
                }, 2000);
                AlertUtil.ToastShort(this, "获取id错误立即返回");
            }
            InitNews();

            //shareWidget = new UMengShareWidget(this);
        }
Exemple #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();
        }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            // Create your application here
            StatusBarUtil.SetColorStatusBars(this);
            SetToolBarNavBack();

            rg_isPrivate         = FindViewById <RadioGroup>(Resource.Id.rg_isPrivate);
            rb_false             = FindViewById <RadioButton>(Resource.Id.rb_false);
            rb_true              = FindViewById <RadioButton>(Resource.Id.rb_true);
            btn_submit           = FindViewById <Button>(Resource.Id.btn_submit);
            btn_submit.Enabled   = false;
            ly_expire            = FindViewById <LinearLayout>(Resource.Id.ly_expire);
            tv_startLogin        = FindViewById <TextView>(Resource.Id.tv_startLogin);
            et_content           = FindViewById <EditText>(Resource.Id.et_content);
            tv_startLogin.Click += (s, e) =>
            {
                StartActivity(new Intent(this, typeof(loginactivity)));
            };

            AlertUtil.ToastLong(this, "当前线程id:" + Thread.CurrentThread.ManagedThreadId);

            string title = Intent.GetStringExtra("title");
            string url   = Intent.GetStringExtra("url");



            Token token = UserTokenUtil.GetToken(this);

            if (token.IsExpire)
            {
                btn_submit.Enabled   = false;
                ly_expire.Visibility = ViewStates.Visible;
            }
            else
            {
                btn_submit.Enabled   = true;
                ly_expire.Visibility = ViewStates.Gone;
            }
            et_content.TextChanged += (s, e) =>
            {
                string content = et_content.Text.Trim();
                if (!string.IsNullOrEmpty(content))
                {
                    btn_submit.Enabled = true;
                }
                else
                {
                    btn_submit.Enabled = false;
                }
            };
            btn_submit.Click += SubmitClick;
        }
Exemple #8
0
        protected override async void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetToolBarNavBack();
            StatusBarUtil.SetColorStatusBars(this);
            SetToolBarTitle(Resources.GetString(Resource.String.bookmark_my));
            _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);
            ly_expire     = FindViewById <LinearLayout>(Resource.Id.ly_expire);
            tv_startLogin = FindViewById <TextView>(Resource.Id.tv_startLogin);
            _recyclerView = FindViewById <RecyclerView>(Resource.Id.recyclerView);
            _recyclerView.SetLayoutManager(new Android.Support.V7.Widget.LinearLayoutManager(this));

            token = UserTokenUtil.GetToken(this);
            if (token.IsExpire)
            {
                ly_expire.Visibility           = ViewStates.Visible;
                _swipeRefreshLayout.Visibility = ViewStates.Gone;
                tv_startLogin.Click           += (s, e) =>
                {
                    StartActivity(new Intent(this, typeof(loginactivity)));
                };
                return;
            }
            else
            {
                ly_expire.Visibility           = ViewStates.Gone;
                _swipeRefreshLayout.Visibility = ViewStates.Visible;
            }

            bookMarkList = await listBookmarkServer();

            if (bookMarkList != null && bookMarkList.Count > 0)
            {
                initRecycler();
            }
        }
Exemple #9
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            StatusBarUtil.SetColorStatusBars(this);
            LinearLayout ll_csdn        = FindViewById <LinearLayout>(Resource.Id.ll_csdn);
            LinearLayout ll_qq          = FindViewById <LinearLayout>(Resource.Id.ll_qq);
            LinearLayout ll_joinQQGroup = FindViewById <LinearLayout>(Resource.Id.ll_joinQQGroup);
            LinearLayout ll_version     = FindViewById <LinearLayout>(Resource.Id.ll_version);

            updManager = IFlytekUpdate.GetInstance(this.ApplicationContext);
            updManager.SetDebugMode(true);
            updManager.SetParameter(UpdateConstants.ExtraWifionly, "true");
            updManager.SetParameter(UpdateConstants.ExtraNotiIcon, "true");
            ll_version.Click += (s, e) =>
            {
                updManager.SetParameter(UpdateConstants.ExtraStyle, UpdateConstants.UpdateUiDialog);
                updManager.AutoUpdate(this, this);
            };
            ll_csdn.Click += (s, e) =>
            {
                //  Intent intent = new Intent();
                //intent.SetAction("android.intent.action.VIEW");
                Android.Net.Uri uri    = Android.Net.Uri.Parse("http://blog.csdn.net/kebi007");
                Intent          intent = new Intent();
                intent.SetAction("android.intent.action.VIEW");
                intent.SetData(uri);
                StartActivity(intent);
            };
            ll_joinQQGroup.Click += (s, e) =>
            {
                joinQQGroup("Q90lFEYkStricLdyCyJQMzJJq_5bo7gb");
            };
            ll_qq.Click += (s, e) =>
            {
                string qqUrl = "mqqwpa://im/chat?chat_type=wpa&uin=976720945&version=1";
                StartActivity(new Intent(Intent.ActionView, Android.Net.Uri.Parse(qqUrl)));
            };
            // Create your application here
        }
Exemple #10
0
 protected override async void OnCreate(Bundle savedInstanceState)
 {
     base.OnCreate(savedInstanceState);
     answerId   = Intent.GetIntExtra("answerId", 0);
     questionId = Intent.GetIntExtra("questionId", 0);
     commentId  = Intent.GetIntExtra("commentId", 0);
     content    = Intent.GetStringExtra("content");
     SetToolBarNavBack();
     StatusBarUtil.SetColorStatusBars(this);
     SetToolBarTitle("±à¼­ÆÀÂÛ");
     //ÏÔʾͼƬÅäÖÃ
     edit_content = FindViewById <EditText>(Resource.Id.edit_content);
     btn_submit   = FindViewById <Button>(Resource.Id.btn_submit);
     userToken    = UserTokenUtil.GetToken(this);
     if (!string.IsNullOrEmpty(content))
     {
         edit_content.SetText(HtmlUtil.GetHtml(content), TextView.BufferType.Spannable);
         btn_submit.Enabled = true;
     }
     //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;
         }
         else
         {
             btn_submit.Enabled = false;
         }
     };
     userInfo = UserInfoShared.GetUserInfo(this);
 }
Exemple #11
0
        protected override async void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.searchInput);
            var app = ((InitApp)ApplicationContext);

            if (app != null)
            {
                app.addActivity(this);
            }
            StatusBarUtil.SetColorStatusBars(this);
            Android.Support.V7.Widget.Toolbar toolbar = FindViewById <Android.Support.V7.Widget.Toolbar>(Resource.Id.toolbar);
            toolbar.SetNavigationIcon(Resource.Drawable.back_24dp);
            toolbar.NavigationClick += (s, e) =>
            {
                //ActivityCompat.FinishAfterTransition(this);
                ActivityCompat.FinishAfterTransition(this);
                this.Finish();
            };

            initSearchHistory();
            category       = Intent.GetStringExtra("category");
            keyword        = Intent.GetStringExtra("keyword");
            search_keyword = FindViewById <SearchView>(Resource.Id.search_keyword);
            search_keyword.QueryTextSubmit += (h, _keyword) =>
            {
                keyword = _keyword.Query.Trim();
                if (keyword == null || keyword.Length == 0)
                {
                    return;
                }
                SearchResultActivity.Enter(category, keyword, true, this);
            };
            //search_keyword.SetIconifiedByDefault(false); //设置展开图标的样式
            search_keyword.OnActionViewExpanded(); //初始可以点击输入的状态
            search_keyword.RequestFocus();         //将控件设置成可获取焦点状态,默认是无法获取焦点的,只有设置成true,才能获取控件的点击事件
            search_keyword.Focusable = true;
        }
Exemple #12
0
        //private static Context context => this;
        protected override void OnCreate(Bundle savedinstancestate)
        {
            base.OnCreate(savedinstancestate);
            StatusBarUtil.SetColorStatusBars(this);
            // create your application here
            // toolbar = findviewbyid<toolbar>(resource.id.toolbar);
            // toolbar.SetNavigationIcon(Resource.Drawable.back_24dp);
            //toolbar.Title = "怬";
            progressBar     = FindViewById <ProgressBar>(Resource.Id.progressBar_login);
            progressBar.Max = 100;
            loginview       = FindViewById <WebView>(Resource.Id.webview_login);
            loginview.Settings.SetSupportZoom(true);
            loginview.Settings.JavaScriptEnabled   = true;
            loginview.Settings.BuiltInZoomControls = true;
            loginview.Settings.CacheMode           = CacheModes.NoCache;
            WebViewClient webClient = new WebViewClient();

            loginview.SetWebChromeClient(new loginwebchromeclient(progressBar));
            loginview.SetWebViewClient(new loginwebviewclient(this));
            string url = string.Format(Constact.GetAuthrize, Constact.client_id);

            loginview.LoadUrl(url);
        }
Exemple #13
0
        protected override async void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            addActivity(this);

            StatusBarUtil.SetColorStatusBars(this);
            handler = new Handler();
            _fm     = SupportFragmentManager;
            //SetSupportActionBar(_toolbar);
            tv_blog       = FindViewById <TextView>(Resource.Id.tv_blog);
            tv_news       = FindViewById <TextView>(Resource.Id.tv_news);
            tv_status     = FindViewById <TextView>(Resource.Id.tv_status);
            tv_question   = FindViewById <TextView>(Resource.Id.tv_question);
            tv_userCenter = FindViewById <TextView>(Resource.Id.tv_userCenter);
            BindViewsClick();
            tv_blog.PerformClick();
            updManager = IFlytekUpdate.GetInstance(this.ApplicationContext);
            updManager.SetDebugMode(true);
            updManager.SetParameter(UpdateConstants.ExtraWifionly, "true");
            updManager.SetParameter(UpdateConstants.ExtraNotiIcon, "true");
            updManager.SetParameter(UpdateConstants.ExtraStyle, UpdateConstants.UpdateUiDialog);
            updManager.AutoUpdate(this, this);
        }
Exemple #14
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);
        }
Exemple #15
0
        protected override async void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            blogApp = Intent.GetStringExtra("blogApp");
            SetToolBarNavBack();
            StatusBarUtil.SetColorStatusBars(this);
            SetToolBarTitle(Resources.GetString(Resource.String.myBlog));
            tv_articleCount = FindViewById <TextView>(Resource.Id.tv_articleCount);
            tv_userName     = FindViewById <TextView>(Resource.Id.tv_userName);
            headPic         = FindViewById <ImageView>(Resource.Id.headPic);
            UserBlog userBlog = UserBlogShared.GetUserBlog(this);
            UserInfo userInfo = UserInfoShared.GetUserInfo(this);

            tv_articleCount.Text = "ÎÄÕÂÊý£º " + userBlog.PostCount;
            tv_userName.Text     = userInfo.DisplayName;
            //ÏÔʾͼƬÅäÖÃ
            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();
            ImageLoader.Instance.DisplayImage(userInfo.Avatar, headPic, options);
            _swipeRefreshLayout = FindViewById <SwipeRefreshLayout>(Resource.Id.swipeRefreshLayout);
            _swipeRefreshLayout.SetColorSchemeResources(Resource.Color.primary);
            _swipeRefreshLayout.SetOnRefreshListener(this);


            ly_expire     = FindViewById <LinearLayout>(Resource.Id.ly_expire);
            tv_startLogin = FindViewById <TextView>(Resource.Id.tv_startLogin);
            _recyclerView = FindViewById <RecyclerView>(Resource.Id.recyclerView);
            _recyclerView.SetLayoutManager(new Android.Support.V7.Widget.LinearLayoutManager(this));

            Token token = UserTokenUtil.GetToken(this);

            if (token.IsExpire)
            {
                ly_expire.Visibility           = ViewStates.Visible;
                _swipeRefreshLayout.Visibility = ViewStates.Gone;
                tv_startLogin.Click           += (s, e) =>
                {
                    StartActivity(new Intent(this, typeof(loginactivity)));
                };
                return;
            }
            else
            {
                ly_expire.Visibility           = ViewStates.Gone;
                _swipeRefreshLayout.Visibility = ViewStates.Visible;
                articleList = await SQLiteUtil.SelectArticleList(Constact.PageSize, true);

                if (articleList != null)
                {
                    initRecycler();
                }
                OnRefresh();
            }
        }
Exemple #16
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());
            }
        }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            // Create your application here
            StatusBarUtil.SetColorStatusBars(this);
            SetToolBarNavBack();

            rg_flags = FindViewById <RadioGroup>(Resource.Id.rg_flags);
            rb_false = FindViewById <RadioButton>(Resource.Id.rb_false);
            rb_true  = FindViewById <RadioButton>(Resource.Id.rb_true);

            edit_title         = FindViewById <EditText>(Resource.Id.edit_title);
            edit_tags          = FindViewById <EditText>(Resource.Id.edit_tags);
            edit_content       = FindViewById <EditText>(Resource.Id.edit_content);
            btn_submit         = FindViewById <Button>(Resource.Id.btn_submit);
            btn_submit.Enabled = true;
            ly_expire          = FindViewById <LinearLayout>(Resource.Id.ly_expire);
            tv_startLogin      = FindViewById <TextView>(Resource.Id.tv_startLogin);
            ll_content         = FindViewById <LinearLayout>(Resource.Id.ll_content);

            ll_content.Click += (s, e) =>
            {
                edit_content.Focusable = true;
            };
            tv_startLogin.Click += (s, e) =>
            {
                StartActivity(new Intent(this, typeof(loginactivity)));
            };
            userToken = UserTokenUtil.GetToken(this);
            //radiobutton单击事件
            rg_flags.CheckedChange += (s, e) =>
            {
                if (e.CheckedId == rb_true.Id)
                {
                    flags = "1";
                }
                else if (e.CheckedId == rb_false.Id)
                {
                    flags = "0";
                }
            };
            //验证是否登录
            if (userToken.IsExpire)
            {
                btn_submit.Enabled   = false;
                ly_expire.Visibility = ViewStates.Visible;
            }
            else
            {
                btn_submit.Enabled   = true;
                ly_expire.Visibility = ViewStates.Gone;
            }
            //验证提交按钮
            edit_title.TextChanged += (s, e) =>
            {
                if (string.IsNullOrEmpty(edit_title.Text.Trim()) || string.IsNullOrEmpty(edit_content.Text.Trim()))
                {
                    btn_submit.Enabled = false;
                }
                else
                {
                    btn_submit.Enabled = true;
                }
            };
            edit_content.TextChanged += (s, e) =>
            {
                if (string.IsNullOrEmpty(edit_content.Text.Trim()) || string.IsNullOrEmpty(edit_title.Text.Trim()))
                {
                    btn_submit.Enabled = false;
                }
                else
                {
                    btn_submit.Enabled = true;
                }
            };
            btn_submit.Click += AddQuestionClick;
        }
Exemple #18
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);
            };
        }
        protected override async void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.searchResult);
            var app = ((InitApp)ApplicationContext);

            if (app != null)
            {
                app.addActivity(this);
            }
            tv_question    = FindViewById <TextView>(Resource.Id.tv_question);
            tv_news        = FindViewById <TextView>(Resource.Id.tv_news);
            tv_kb          = FindViewById <TextView>(Resource.Id.tv_kb);
            tv_blog        = FindViewById <TextView>(Resource.Id.tv_blog);
            search_keyword = FindViewById <SearchView>(Resource.Id.search_keyword);
            _recyclerView  = FindViewById <RecyclerView>(Resource.Id.recyclerView);
            Android.Support.V7.Widget.Toolbar toolbar = FindViewById <Android.Support.V7.Widget.Toolbar>(Resource.Id.toolbar);
            swipeRefreshLayout = FindViewById <SwipeRefreshLayout>(Resource.Id.swipeRefreshLayout);
            swipeRefreshLayout.SetColorScheme(Resource.Color.primary);
            swipeRefreshLayout.Refreshing = false;
            StatusBarUtil.SetColorStatusBars(this);
            category   = Intent.GetStringExtra("category");
            keyword    = Intent.GetStringExtra("keyword");
            startQuery = Intent.GetBooleanExtra("startquery", false);


            initCategoryClick();      //初始化category单击事件
            initCategoryByCategory(); //初始化category 选中的状态
            toolbar.SetNavigationIcon(Resource.Drawable.back_24dp);
            toolbar.NavigationClick += (s, e) =>
            {
                ActivityCompat.FinishAfterTransition(this);
            };
            swipeRefreshLayout.Refresh += (s, e) =>
            {
                swipeRefreshLayout.PostDelayed(() => {
                    swipeRefreshLayout.Refreshing = false;
                }, 1000);
            };
            _recyclerView.SetLayoutManager(new Android.Support.V7.Widget.LinearLayoutManager(this));

            //search_keyword.SubmitButtonEnabled = true; //默认为false 不显示提交按钮,是否启用提交按钮
            search_keyword.OnActionViewExpanded(); //手动展开SearchView输入框,初始可以点击输入的状态
                                                   //search_keyword.SetIconifiedByDefault(false); //默认是为true 不显示输入框键盘,默认提交按钮不显示,该属性设置为false,则直接展开输入框弹出键盘
                                                   // search_keyword.RequestFocus(); //将控件设置成可获取焦点状态,默认是无法获取焦点的,只有设置成true,才能获取控件的点击事件
                                                   //search_keyword.Focusable = true;
            search_keyword.ClearFocus();
            search_keyword.Focusable = true;
            if (!string.IsNullOrEmpty(keyword))
            {
                search_keyword.QueryHint = keyword;
            }
            search_keyword.FocusChange += (s, e) =>
            {
                System.Diagnostics.Debug.Write(e.HasFocus);
                if (e.HasFocus)
                {
                    SearchInputActivity.Enter(category, this);
                }
            };

            search_keyword.SetOnQueryTextFocusChangeListener(this);
            search_keyword.QueryTextSubmit += async(s, e) =>
            {
                keyword = search_keyword.Query.Trim();
                if (keyword == null || keyword.Length == 0)
                {
                    return;
                }
                SearchHistoryShared.SetSearchHistory(keyword, this);
                swipeRefreshLayout.Refreshing = true;
                await listSearchService((list) => {
                    swipeRefreshLayout.PostDelayed(() => {
                        swipeRefreshLayout.Refreshing = false;
                    }, 1000);
                    searchList = list;
                    initRecycler();
                });
            };

            if (startQuery)
            {
                initCategoryByCategory();
                SearchHistoryShared.SetSearchHistory(keyword, this);
                if (!string.IsNullOrEmpty(keyword))
                {
                    swipeRefreshLayout.Refreshing = true;
                    await listSearchService((list) => {
                        swipeRefreshLayout.PostDelayed(() => {
                            swipeRefreshLayout.Refreshing = false;
                        }, 1000);
                        searchList = list;
                        initRecycler();
                    });
                }
            }
        }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            // Create your application here
            StatusBarUtil.SetColorStatusBars(this);
            SetToolBarNavBack();

            edit_url             = FindViewById <EditText>(Resource.Id.edit_url);
            edit_title           = FindViewById <EditText>(Resource.Id.edit_title);
            edit_summary         = FindViewById <EditText>(Resource.Id.edit_summary);
            edit_tags            = FindViewById <EditText>(Resource.Id.edit_tags);
            btn_submit           = FindViewById <Button>(Resource.Id.btn_submit);
            ly_expire            = FindViewById <LinearLayout>(Resource.Id.ly_expire);
            tv_startLogin        = FindViewById <TextView>(Resource.Id.tv_startLogin);
            tv_startLogin.Click += (s, e) =>
            {
                StartActivity(new Intent(this, typeof(loginactivity)));
            };
            AlertUtil.ToastLong(this, "当前线程id:" + Thread.CurrentThread.ManagedThreadId);

            string title = Intent.GetStringExtra("title");
            string url   = Intent.GetStringExtra("url");

            mode = Intent.GetStringExtra("mode");

            edit_url.Text   = string.IsNullOrEmpty(url)?"":url;
            edit_title.Text = string.IsNullOrEmpty(title)?"":title;
            Token token = UserTokenUtil.GetToken(this);

            if (mode == "edit")
            {
                string editTitle = Resources.GetString(Resource.String.bookmark_edit);
                btn_submit.Text = editTitle;
                SetToolBarTitle(editTitle);
                string summary = Intent.GetStringExtra("summary");
                string tags    = Intent.GetStringExtra("tags");
                wzLinkId = Intent.GetIntExtra("id", 0);
                if (!string.IsNullOrEmpty(summary))
                {
                    edit_summary.Text = summary;
                }
                if (!string.IsNullOrEmpty(tags))
                {
                    edit_tags.Text = tags;
                }
            }
            else if (mode == "add")
            {
                btn_submit.Text = "添加收藏";
            }
            //判断是否登录
            if (token.IsExpire)
            {
                btn_submit.Enabled   = false;
                ly_expire.Visibility = ViewStates.Visible;
            }
            else
            {
                btn_submit.Enabled   = true;
                ly_expire.Visibility = ViewStates.Gone;
            }
            btn_submit.Click += async(s, e) =>
            {
                var userToken = UserTokenUtil.GetToken(this);
                if (userToken.IsExpire)
                {
                    Android.Support.V7.App.AlertDialog.Builder alertDialog = new Android.Support.V7.App.AlertDialog.Builder(this)
                                                                             .SetTitle("登录提示")
                                                                             .SetMessage("未登录或登录token已经过期")
                                                                             .SetPositiveButton("授权", (s1, e1) =>
                    {
                        StartActivity(new Intent(this, typeof(loginactivity)));
                    })
                                                                             .SetNegativeButton("取消", (s1, e1) =>
                    {
                        return;
                    });
                    alertDialog.Create().Show();
                }
                if (edit_summary.Text.Length > 200)
                {
                    AlertUtil.ToastShort(this, "摘要不能超过200字符");
                    return;
                }
                if (token.IsExpire)
                {
                    AlertUtil.ToastShort(this, "未登录或登录token已经过期,请邓丽");
                    return;
                }
                var model = new BookmarksModel();
                model.Title   = edit_title.Text;
                model.LinkUrl = edit_url.Text;
                model.Summary = edit_summary.Text;
                model.Tags    = edit_tags.Text.Split(',').ToList();
                var dialog = new ProgressDialog(this);
                dialog.SetProgressStyle(ProgressDialogStyle.Spinner);
                dialog.SetCancelable(false);
                dialog.SetCanceledOnTouchOutside(false);
                dialog.SetTitle(Resources.GetString(Resource.String.bookmark_add));
                dialog.SetMessage("提交中.......");
                dialog.Show();
                if (mode == "add")
                {
                    var result = await BookmarksService.Add(token, model);

                    if (result.Success)
                    {
                        btn_submit.Enabled = false;
                        dialog.Hide();
                        AlertUtil.ToastLong(this, result.Message + "添加收藏成功");
                        this.Finish();
                        System.Diagnostics.Debug.Write(result.Message);
                    }
                    else
                    {
                        dialog.Hide();
                        AlertUtil.ToastLong(this, result.Message);
                        System.Diagnostics.Debug.Write(result);
                    }
                }
                if (mode == "edit")
                {
                    model.WzLinkId = wzLinkId;
                    BookmarksService.Edit(token, model, (result) => {
                        if (result.IsSuccess)
                        {
                            RunOnUiThread(() => {
                                dialog.Hide();
                                btn_submit.Enabled = false;
                                AlertUtil.ToastLong(this, result.Message + "编辑收藏成功");
                            });
                            System.Diagnostics.Debug.Write(result.Message);
                        }
                        else
                        {
                            RunOnUiThread(() =>
                            {
                                dialog.Hide();
                                AlertUtil.ToastLong(this, result.Message);
                                System.Diagnostics.Debug.Write(result);
                            });
                        }
                    });
                }
            };
        }