Пример #1
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            StatusBarCompat.SetOrdinaryToolBar(this);
            handler        = new Handler();
            loginPresenter = new LoginPresenter(this);
            toolbar        = FindViewById <Toolbar>(Resource.Id.toolbar);
            toolbar.SetNavigationIcon(Resource.Drawable.back_24dp);
            SetSupportActionBar(toolbar);
            SupportActionBar.SetDisplayHomeAsUpEnabled(true);
            toolbar.SetNavigationOnClickListener(this);

            progressBar     = FindViewById <ProgressBar>(Resource.Id.progressBar);
            progressBar.Max = 100;
            dialog          = new ProgressDialog(this);
            dialog.SetCancelable(false);
            dialog.SetMessage("正在获取token");

            loginView = FindViewById <WebView>(Resource.Id.loginView);
            loginView.Settings.JavaScriptEnabled = true;
            loginView.Settings.SetSupportZoom(true);
            loginView.Settings.BuiltInZoomControls = true;
            loginView.SetWebChromeClient(new LoginWebChromeClient(progressBar));
            loginView.SetWebViewClient(new LoginWebViewClient(this));
            loginView.LoadUrl(string.Format(ApiUtils.Authorize, Resources.GetString(Resource.String.ClientId)) + new Random().Next(1000, 9999));
        }
Пример #2
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(GetLayoutId());

            AppManager.Instance.AddActivity(this);

            if (statusBarColor == 0)
            {
                statusBarView =
                    StatusBarCompat.Compat(this, ContextCompat.GetColor(this, Resource.Color.colorPrimaryDark));
            }
            else if (statusBarColor != -1)
            {
                statusBarView = StatusBarCompat.Compat(this, statusBarColor);
            }

            Context = this;
            BindViews();
            CommonToolbar = FindViewById <Toolbar>(Resource.Id.common_toolbar);
            if (CommonToolbar != null)
            {
                InitToolBar();
                SetSupportActionBar(CommonToolbar);
            }

            InitData();
            ConfigViews();

            //申请截屏权限
            ScreenPermissions();
            FilePermissions();
        }
Пример #3
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            StatusBarCompat.SetOrdinaryToolBar(this);

            toolbar = FindViewById <Toolbar>(Resource.Id.toolbar);
            toolbar.SetNavigationIcon(Resource.Drawable.back_24dp);
            SetSupportActionBar(toolbar);
            SupportActionBar.SetDisplayHomeAsUpEnabled(true);
            toolbar.SetNavigationOnClickListener(this);
            searchView = FindViewById <SearchView>(Resource.Id.searchView);
            searchView.SetIconifiedByDefault(true);
            searchView.OnActionViewExpanded();
            searchView.SetOnQueryTextListener(this);

            viewPager = FindViewById <ViewPager>(Resource.Id.viewPager);
            viewPager.OffscreenPageLimit = 4;

            TabLayout tabs = FindViewById <TabLayout>(Resource.Id.tabLayout);

            adapter = new SearchTabsAdapter(this.SupportFragmentManager, Resources.GetStringArray(Resource.Array.SearchTabs).ToList());

            viewPager.Adapter = adapter;
            tabs.SetupWithViewPager(viewPager);
            tabs.AddOnTabSelectedListener(this);
        }
Пример #4
0
        private CustomDialog dialog;//进度条

        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(getLayoutId());
            if (statusBarColor == 0)
            {
                statusBarView = StatusBarCompat.compat(this, ContextCompat.GetColor(this, Resource.Color.colorPrimaryDark));
            }
            else if (statusBarColor != -1)
            {
                statusBarView = StatusBarCompat.compat(this, statusBarColor);
            }
            transparent19and20();
            mContext = this;
            bindViews();
            mCommonToolbar = FindViewById <Toolbar>(Resource.Id.common_toolbar);
            if (mCommonToolbar != null)
            {
                initToolBar();
                SetSupportActionBar(mCommonToolbar);
            }
            initDatas();
            configViews();
            mNowMode = SharedPreferencesUtil.getInstance().getBoolean(Constant.ISNIGHT);
        }
Пример #5
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            var linkUrl     = Intent.GetStringExtra("linkurl");
            var title       = Intent.GetStringExtra("title");
            var fromCNBlogs = Intent.GetBooleanExtra("fromCNBlogs", false);

            bookmarkPresenter = new BookmarkAddPresenter(this);
            handler           = new Handler();
            dialog            = new ProgressDialog(this);
            dialog.SetCancelable(false);
            StatusBarCompat.SetOrdinaryToolBar(this);
            toolbar = FindViewById <Toolbar>(Resource.Id.toolbar);
            toolbar.SetNavigationIcon(Resource.Drawable.back_24dp);
            SetSupportActionBar(toolbar);
            SupportActionBar.SetDisplayHomeAsUpEnabled(true);
            toolbar.SetNavigationOnClickListener(this);
            toolbar.SetOnMenuItemClickListener(this);

            txtLinkUrl = FindViewById <EditText>(Resource.Id.txtLinkUrl);
            txtTitle   = FindViewById <EditText>(Resource.Id.txtTitle);
            txtTags    = FindViewById <EditText>(Resource.Id.txtTags);
            txtContent = FindViewById <EditText>(Resource.Id.txtContent);

            txtLinkUrl.Text = linkUrl;
            if (linkUrl != null && linkUrl != "")
            {
                txtLinkUrl.SetSelection(txtLinkUrl.Text.Length);
            }
            txtTitle.Text = title;

            bookmark             = new BookmarksModel();
            bookmark.FromCNBlogs = fromCNBlogs;
        }
Пример #6
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            handler = new Handler();

            toolbar = FindViewById <Toolbar>(Resource.Id.toolbar);
            toolbar.SetNavigationIcon(Resource.Drawable.search_dark_24dp);
            SetSupportActionBar(toolbar);
            SupportActionBar.SetDisplayHomeAsUpEnabled(true);
            toolbar.SetNavigationOnClickListener(this);

            searchView           = FindViewById <SearchView>(Resource.Id.searchView);
            searchView.Focusable = false;
            searchView.SetIconifiedByDefault(true);
            searchView.OnActionViewExpanded();
            searchView.SetOnQueryTextListener(this);

            var searchAutoComplete = (SearchView.SearchAutoComplete)searchView.FindViewById(Resource.Id.search_src_text);

            searchAutoComplete.SetTextColor(GetColorStateList(Resource.Color.title_color));
            searchAutoComplete.SetTextSize(Android.Util.ComplexUnitType.Sp, 14);
            searchAutoComplete.SetHintTextColor(GetColorStateList(Resource.Color.subtitle_color));
            searchAutoComplete.OnFocusChangeListener = this;

            StatusBarCompat.SetOrdinaryToolBar(this);

            bottomBar = BottomBar.AttachShy(FindViewById <CoordinatorLayout>(Resource.Id.coordinatorLayout), FindViewById(Resource.Id.frameContent), savedInstanceState);

            bottomBar.UseFixedMode();
            bottomBar.SetItems(Resource.Menu.bottombar_menu);
            bottomBar.SetOnTabClickListener(this);
        }
Пример #7
0
 public void translucentStatusBar()
 {
     //CrossCurrentActivity.Current.Activity.Window.SetStatusBarColor(Android.Graphics.Color.Transparent);
     //StatusBarCompat.TranslucentStatusBar(CrossCurrentActivity.Current.Activity);
     //StatusBarCompat.SetStatusBarColor(CrossCurrentActivity.Current.Activity, 10);
     StatusBarCompat.TranslucentStatusBar(CrossCurrentActivity.Current.Activity);
     //StatusBarCompat.ChangeToLightStatusBar(CrossCurrentActivity.Current.Activity);
 }
Пример #8
0
        protected override async void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            Id = Intent.GetIntExtra("id", 0);
            statusPresenter  = new StatusPresenter(this);
            commentPresenter = new StatusCommentsPresenter(this);
            handler          = new Handler();

            StatusBarCompat.SetOrdinaryToolBar(this);
            toolbar = FindViewById <Toolbar>(Resource.Id.toolbar);
            toolbar.SetNavigationIcon(Resource.Drawable.back_24dp);
            SetSupportActionBar(toolbar);
            SupportActionBar.SetDisplayHomeAsUpEnabled(true);
            toolbar.SetNavigationOnClickListener(this);

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

            userName     = FindViewById <TextView>(Resource.Id.txtUserName);
            imgUserUrl   = FindViewById <ImageView>(Resource.Id.imgUserUrl);
            imgPrivate   = FindViewById <ImageView>(Resource.Id.imgPrivate);
            imgDelete    = FindViewById <ImageButton>(Resource.Id.imgDelete);
            txtPostdate  = FindViewById <TextView>(Resource.Id.txtPostdate);
            txtBody      = FindViewById <TextView>(Resource.Id.txtBody);
            commentCount = FindViewById <TextView>(Resource.Id.txtCommentCount);

            txtContent = FindViewById <TextView>(Resource.Id.txtContent);
            proLoading = FindViewById <ProgressBar>(Resource.Id.proLoading);
            btnComment = FindViewById <TextView>(Resource.Id.btnComment);
            btnComment.SetOnClickListener(this);

            recyclerView = FindViewById <RecyclerView>(Resource.Id.recyclerView);
            recyclerView.SetLayoutManager(new LinearLayoutManager(this));
            recyclerView.NestedScrollingEnabled = false;
            adapter = new StatusCommentsAdapter();
            adapter.OnDeleteClickListener = this;
            adapter.User = await SQLiteUtils.Instance().QueryUser();

            recyclerView.SetAdapter(adapter);

            notDataView        = this.LayoutInflater.Inflate(Resource.Layout.empty_view, (ViewGroup)recyclerView.Parent, false);
            notDataView.Click += delegate(object sender, EventArgs e)
            {
                OnRefresh();
            };
            errorView        = this.LayoutInflater.Inflate(Resource.Layout.error_view, (ViewGroup)recyclerView.Parent, false);
            errorView.Click += delegate(object sender, EventArgs e)
            {
                OnRefresh();
            };
            recyclerView.Post(async() =>
            {
                await statusPresenter.GetClientStatus(Id);
                OnRefresh();
            });
        }
Пример #9
0
        protected async override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            blogApp       = Intent.GetStringExtra("blogApp");
            blogPresenter = new BlogPresenter(this);
            handler       = new Handler();

            coordinatorLayout = FindViewById <CoordinatorLayout>(Resource.Id.coordinatorLayout);
            appBarLayout      = FindViewById <AppBarLayout>(Resource.Id.appbar);
            linearLayout      = FindViewById <LinearLayout>(Resource.Id.linearLayout);

            toolbar = FindViewById <Toolbar>(Resource.Id.toolbar);
            toolbar.SetNavigationIcon(Resource.Drawable.back_24dp);
            SetSupportActionBar(toolbar);
            SupportActionBar.SetDisplayHomeAsUpEnabled(true);
            toolbar.SetNavigationOnClickListener(this);

            StatusBarCompat.SetCollapsingToolbar(this, coordinatorLayout, appBarLayout, linearLayout, toolbar);

            imgAvatar   = FindViewById <ImageView>(Resource.Id.avatar);
            txtTitle    = FindViewById <TextView>(Resource.Id.txtTitle);
            txtSubTitle = FindViewById <TextView>(Resource.Id.txtSubTitle);

            user = await SQLiteUtils.Instance().QueryUser();

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

            recyclerView = FindViewById <RecyclerView>(Resource.Id.recyclerView);
            var manager = new LinearLayoutManager(this);

            recyclerView.SetLayoutManager(manager);

            adapter = new ArticlesAdapter();
            adapter.SetOnLoadMoreListener(this);

            recyclerView.SetAdapter(adapter);
            notDataView        = this.LayoutInflater.Inflate(Resource.Layout.empty_view, (ViewGroup)recyclerView.Parent, false);
            notDataView.Click += delegate(object sender, EventArgs e)
            {
                OnRefresh();
            };
            errorView        = this.LayoutInflater.Inflate(Resource.Layout.error_view, (ViewGroup)recyclerView.Parent, false);
            errorView.Click += delegate(object sender, EventArgs e)
            {
                OnRefresh();
            };
            recyclerView.Post(async() =>
            {
                await blogPresenter.GetClientBlog(blogApp);
                OnRefresh();
            });
        }
Пример #10
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            Id = Intent.GetIntExtra("id", 0);
            articlePresenter = new ArticlePresenter(this);
            handler          = new Handler();

            StatusBarCompat.SetOrdinaryToolBar(this);
            toolbar = FindViewById <Toolbar>(Resource.Id.toolbar);
            toolbar.SetNavigationIcon(Resource.Drawable.back_24dp);
            SetSupportActionBar(toolbar);
            SupportActionBar.SetDisplayHomeAsUpEnabled(true);
            toolbar.SetNavigationOnClickListener(this);
            toolbar.SetOnMenuItemClickListener(this);
            swipeRefreshLayout = FindViewById <SwipeRefreshLayout>(Resource.Id.swipeRefreshLayout);
            swipeRefreshLayout.SetColorSchemeResources(Resource.Color.primary);
            swipeRefreshLayout.SetOnRefreshListener(this);
            scrollView = FindViewById <NestedScrollView>(Resource.Id.scrollView);

            txtTitle    = FindViewById <TextView>(Resource.Id.txtTitle);
            imgAvatar   = FindViewById <ImageView>(Resource.Id.llAvatar);
            txtAuthor   = FindViewById <TextView>(Resource.Id.txtAuthor);
            txtPostdate = FindViewById <TextView>(Resource.Id.txtPostdate);
            txtBody     = FindViewById <WebView>(Resource.Id.txtBody);
            txtBody.Settings.JavaScriptEnabled        = true;
            txtBody.Settings.DomStorageEnabled        = true;
            txtBody.Settings.LoadsImagesAutomatically = true;
            txtBody.Settings.DefaultTextEncodingName  = "utf-8";
            txtBody.SetWebViewClient(BodyWebViewClient.With(this));
            txtBody.ScrollBarStyle = ScrollbarStyles.InsideOverlay;
            txtBody.Settings.SetSupportZoom(false);
            txtBody.Settings.BuiltInZoomControls = false;
            txtBody.Settings.CacheMode           = CacheModes.CacheElseNetwork;
            txtBody.Settings.SetLayoutAlgorithm(WebSettings.LayoutAlgorithm.SingleColumn);
            var jsInterface = new WebViewJSInterface(this);

            txtBody.AddJavascriptInterface(jsInterface, "openlistner");
            jsInterface.CallFromPageReceived += delegate(object sender, WebViewJSInterface.CallFromPageReceivedEventArgs e)
            {
                PhotoActivity.Start(this, e.Result.Split(','), e.Index);
            };

            txtDigg     = FindViewById <TextView>(Resource.Id.txtDigg);
            txtRead     = FindViewById <TextView>(Resource.Id.txtRead);
            txtComments = FindViewById <TextView>(Resource.Id.txtComments);
            txtBookmark = FindViewById <TextView>(Resource.Id.txtBookmark);

            swipeRefreshLayout.Post(async() =>
            {
                await articlePresenter.GetClientArticle(Id);
            });

            shareAction = new ShareAction(this).SetDisplayList(SHARE_MEDIA.Weixin, SHARE_MEDIA.WeixinCircle, SHARE_MEDIA.WeixinFavorite, SHARE_MEDIA.Sina).SetShareboardclickCallback(this);
        }
Пример #11
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            handler = new Handler();
            fm      = SupportFragmentManager;

            toolbar = FindViewById <Toolbar>(Resource.Id.toolbar);
            SetSupportActionBar(toolbar);
            toolbar.SetOnMenuItemClickListener(this);

            coordinatorLayout = FindViewById <CoordinatorLayout>(Resource.Id.coordinatorLayout);

            drawerLayout   = FindViewById <DrawerLayout>(Resource.Id.drawerLayout);
            navigationView = FindViewById <NavigationView>(Resource.Id.navigationview);
            var headerLayout = navigationView.InflateHeaderView(Resource.Layout.header_layout);

            navigationView.InflateMenu(Resource.Menu.main);
            navigationView.SetNavigationItemSelectedListener(this);
            Avatar = headerLayout.FindViewById <ImageView>(Resource.Id.headerAvatar);
            Avatar.SetOnClickListener(this);
            Author           = headerLayout.FindViewById <TextView>(Resource.Id.headerAuthor);
            Seniority        = headerLayout.FindViewById <TextView>(Resource.Id.headerSeniority);
            txtLogout        = headerLayout.FindViewById <TextView>(Resource.Id.headerLogout);
            txtLogout.Click += delegate
            {
                LoginUtils.Instance(this).DeleteUser();
                UpdateUserView();
            };

            drawerToggle = new ActionBarDrawerToggle(this, drawerLayout, toolbar, Resource.String.drawer_open, Resource.String.drawer_close);
            drawerLayout.AddDrawerListener(this);
            SupportActionBar.SetDisplayHomeAsUpEnabled(true);
            SupportActionBar.SetHomeButtonEnabled(true);

            StatusBarCompat.SetDrawerToolbarTabLayout(this, coordinatorLayout);

            UpdateUserView();

            navigationView.Post(() =>
            {
                SwitchNavigationBar(Resource.Id.home);
            });

            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);

            shareAction = new ShareAction(this).SetDisplayList(SHARE_MEDIA.Weixin, SHARE_MEDIA.WeixinCircle, SHARE_MEDIA.WeixinFavorite, SHARE_MEDIA.Sina).SetShareboardclickCallback(this);
        }
Пример #12
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            blogApp          = Intent.GetStringExtra("blogApp");
            Id               = Intent.GetIntExtra("id", 0);
            handler          = new Handler();
            commentPresenter = new ArticleCommentsPresenter(this);
            StatusBarCompat.SetOrdinaryToolBar(this);
            dialog = new ProgressDialog(this);
            dialog.SetCancelable(false);

            toolbar = FindViewById <Toolbar>(Resource.Id.toolbar);
            toolbar.SetNavigationIcon(Resource.Drawable.back_24dp);
            SetSupportActionBar(toolbar);
            SupportActionBar.SetDisplayHomeAsUpEnabled(true);
            toolbar.SetNavigationOnClickListener(this);

            txtContent = FindViewById <TextView>(Resource.Id.txtContent);
            proLoading = FindViewById <ProgressBar>(Resource.Id.proLoading);
            btnComment = FindViewById <TextView>(Resource.Id.btnComment);
            btnComment.SetOnClickListener(this);

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

            recyclerView = FindViewById <RecyclerView>(Resource.Id.recyclerView);
            recyclerView.SetLayoutManager(new LinearLayoutManager(this));
            adapter = new ArticleCommentsAdapter();
            adapter.SetOnLoadMoreListener(this);

            notDataView        = this.LayoutInflater.Inflate(Resource.Layout.empty_view, (ViewGroup)recyclerView.Parent, false);
            notDataView.Click += delegate(object sender, EventArgs e)
            {
                OnRefresh();
            };
            errorView        = this.LayoutInflater.Inflate(Resource.Layout.error_view, (ViewGroup)recyclerView.Parent, false);
            errorView.Click += delegate(object sender, EventArgs e)
            {
                OnRefresh();
            };
            recyclerView.SetAdapter(adapter);
            recyclerView.Post(() =>
            {
                swipeRefreshLayout.Refreshing = true;
                OnRefresh();
            });
        }
Пример #13
0
        protected override async void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            Id               = Intent.GetIntExtra("id", 0);
            handler          = new Handler();
            answersPresenter = new QuestionAnswersPresenter(this);
            StatusBarCompat.SetOrdinaryToolBar(this);
            dialog = new ProgressDialog(this);
            dialog.SetCancelable(false);

            toolbar = FindViewById <Toolbar>(Resource.Id.toolbar);
            toolbar.SetNavigationIcon(Resource.Drawable.back_24dp);
            SetSupportActionBar(toolbar);
            SupportActionBar.SetDisplayHomeAsUpEnabled(true);
            toolbar.SetNavigationOnClickListener(this);
            toolbar.SetOnMenuItemClickListener(this);

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

            recyclerView = FindViewById <RecyclerView>(Resource.Id.recyclerView);
            recyclerView.SetLayoutManager(new LinearLayoutManager(this));
            adapter = new QuestionAnswersAdapter();
            adapter.SetOnLoadMoreListener(this);
            adapter.User = await SQLiteUtils.Instance().QueryUser();

            adapter.OnDeleteClickListener = this;

            notDataView        = this.LayoutInflater.Inflate(Resource.Layout.empty_view, (ViewGroup)recyclerView.Parent, false);
            notDataView.Click += delegate(object sender, EventArgs e)
            {
                OnRefresh();
            };
            errorView        = this.LayoutInflater.Inflate(Resource.Layout.error_view, (ViewGroup)recyclerView.Parent, false);
            errorView.Click += delegate(object sender, EventArgs e)
            {
                OnRefresh();
            };
            recyclerView.SetAdapter(adapter);
            recyclerView.Post(() =>
            {
                swipeRefreshLayout.Refreshing = true;
                OnRefresh();
            });
        }
Пример #14
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            questionId       = Intent.GetIntExtra("id", 0);
            answersPresenter = new QuestionAnswersAddPresenter(this);
            handler          = new Handler();
            dialog           = new ProgressDialog(this);
            dialog.SetCancelable(false);
            StatusBarCompat.SetOrdinaryToolBar(this);
            toolbar = FindViewById <Toolbar>(Resource.Id.toolbar);
            toolbar.SetNavigationIcon(Resource.Drawable.back_24dp);
            SetSupportActionBar(toolbar);
            SupportActionBar.SetDisplayHomeAsUpEnabled(true);
            toolbar.SetNavigationOnClickListener(this);
            toolbar.SetOnMenuItemClickListener(this);

            txtContent = FindViewById <EditText>(Resource.Id.txtContent);
        }
Пример #15
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            handler        = new Handler();
            loginPresenter = new LoginPresenter(this);
            StatusBarCompat.SetOrdinaryToolBar(this);

            toolbar = FindViewById <Toolbar>(Resource.Id.toolbar);
            toolbar.SetNavigationIcon(Resource.Drawable.back_24dp);
            SetSupportActionBar(toolbar);
            SupportActionBar.SetDisplayHomeAsUpEnabled(true);
            toolbar.SetNavigationOnClickListener(this);

            editAccount  = FindViewById <EditText>(Resource.Id.account);
            editPassword = FindViewById <EditText>(Resource.Id.password);
            btnLogin     = FindViewById <Button>(Resource.Id.login);
            btnLogin.SetOnClickListener(this);
            dialog = new ProgressDialog(this);
            dialog.SetCancelable(false);
        }
Пример #16
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            handler = new Handler();

            StatusBarCompat.SetOrdinaryToolBar(this);
            toolbar = FindViewById <Toolbar>(Resource.Id.toolbar);
            toolbar.SetNavigationIcon(Resource.Drawable.back_24dp);
            SetSupportActionBar(toolbar);
            SupportActionBar.SetDisplayHomeAsUpEnabled(true);
            toolbar.SetNavigationOnClickListener(this);
            var packageInfo = this.PackageManager.GetPackageInfo(this.PackageName, 0);
            var txtVersion  = FindViewById <TextView>(Resource.Id.txtVersion);

            txtVersion.Text = packageInfo.VersionName;
            FindViewById <LinearLayout>(Resource.Id.layoutSurvey).Click += (object sender, EventArgs e) =>
            {
                Intent intent = new Intent(Intent.ActionSendto);
                intent.AddFlags(ActivityFlags.NewTask);
                intent.SetData(Android.Net.Uri.Parse("mailto:" + Resources.GetString(Resource.String.survey_email)));
                if (intent.ResolveActivity(this.PackageManager) != null)
                {
                    intent.PutExtra(Intent.ExtraSubject, "来自 " + packageInfo.PackageName + " - " + packageInfo.VersionName + " 的反馈意见");
                    intent.PutExtra(Intent.ExtraText, "设备信息:Android " + Build.VERSION.Release + " - " + Build.Manufacturer + " - " + Build.Model + "\n(如果涉及隐私请手动删除这个内容)\n\n");
                    StartActivity(intent);
                }
                else
                {
                    Toast.MakeText(this, "系统中没有安装邮件客户端", ToastLength.Short).Show();
                }
            };
            FindViewById <LinearLayout>(Resource.Id.layoutQQ).Click += (object sender, EventArgs e) =>
            {
                sharesWidget.Open("http://shang.qq.com/wpa/qunwpa?idkey=5c281d37638467fb0f411484dcd513b89ba82b58decb8518cc2523b95232dd9b", "博客园第三方APP开发交流群");
            };
            FindViewById <LinearLayout>(Resource.Id.layoutOpenSourceUrl).Click += (object sender, EventArgs e) =>
            {
                sharesWidget.Open(Resources.GetString(Resource.String.open_source_url), "博客园第三方Android客户端,Xamarin App,Material Design风格");
            };
            sharesWidget = new UMengSharesWidget(this);
        }
Пример #17
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            handler = new Handler();

            StatusBarCompat.SetOrdinaryToolBar(this);
            toolbar = FindViewById <Toolbar>(Resource.Id.toolbar);
            toolbar.SetNavigationIcon(Resource.Drawable.back_24dp);
            SetSupportActionBar(toolbar);
            SupportActionBar.SetDisplayHomeAsUpEnabled(true);
            toolbar.SetNavigationOnClickListener(this);
            var packageInfo = this.PackageManager.GetPackageInfo(this.PackageName, 0);
            var txtVersion  = FindViewById <TextView>(Resource.Id.txtVersion);

            txtVersion.Text = packageInfo.VersionName;
            FindViewById <LinearLayout>(Resource.Id.layoutSurvey).Click += (object sender, EventArgs e) =>
            {
                Intent intent = new Intent(Intent.ActionSendto);
                intent.AddFlags(ActivityFlags.NewTask);
                intent.SetData(Android.Net.Uri.Parse("mailto:" + Resources.GetString(Resource.String.survey_email)));
                if (intent.ResolveActivity(this.PackageManager) != null)
                {
                    intent.PutExtra(Intent.ExtraSubject, "来自 " + packageInfo.PackageName + " - " + packageInfo.VersionName + " 的反馈意见");
                    intent.PutExtra(Intent.ExtraText, "设备信息:Android " + Build.VERSION.Release + " - " + Build.Manufacturer + " - " + Build.Model + "\n(如果涉及隐私请手动删除这个内容)\n\n");
                    StartActivity(intent);
                }
                else
                {
                    Toast.MakeText(this, "系统中没有安装邮件客户端", ToastLength.Short).Show();
                }
            };
            FindViewById <LinearLayout>(Resource.Id.layoutOpenSourceUrl).Click += (object sender, EventArgs e) =>
            {
                Intent intent = new Intent(Intent.ActionView, Android.Net.Uri.Parse(Resources.GetString(Resource.String.open_source_url)));
                intent.SetClassName("com.android.browser", "com.android.browser.BrowserActivity");
                intent.AddFlags(ActivityFlags.NewTask);
                StartActivity(intent);
            };
        }
Пример #18
0
        protected async override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            Id                = Intent.GetIntExtra("id", 0);
            position          = Intent.GetIntExtra("position", position);
            bookmarkPresenter = new BookmarkEditPresenter(this);
            handler           = new Handler();
            dialog            = new ProgressDialog(this);
            dialog.SetCancelable(false);
            StatusBarCompat.SetOrdinaryToolBar(this);
            toolbar = FindViewById <Toolbar>(Resource.Id.toolbar);
            toolbar.SetNavigationIcon(Resource.Drawable.back_24dp);
            SetSupportActionBar(toolbar);
            SupportActionBar.SetDisplayHomeAsUpEnabled(true);
            toolbar.SetNavigationOnClickListener(this);
            toolbar.SetOnMenuItemClickListener(this);

            txtLinkUrl = FindViewById <EditText>(Resource.Id.txtLinkUrl);
            txtTitle   = FindViewById <EditText>(Resource.Id.txtTitle);
            txtTags    = FindViewById <EditText>(Resource.Id.txtTags);
            txtContent = FindViewById <EditText>(Resource.Id.txtContent);

            bookmark = await SQLiteUtils.Instance().QueryBookmark(Id);

            if (bookmark != null && bookmark.WzLinkId > 0)
            {
                txtLinkUrl.Text = bookmark.LinkUrl;
                txtLinkUrl.SetSelection(txtLinkUrl.Text.Length);
                txtTitle.Text   = bookmark.Title;
                txtTags.Text    = bookmark.Tag;
                txtContent.Text = bookmark.Summary;
            }
            else
            {
                Toast.MakeText(this, "获取数据失败,请重试", ToastLength.Short).Show();
            }
        }
Пример #19
0
 void SetStatusBar()
 {
     StatusBarCompat.TranslucentStatusBar(this, true);
 }
Пример #20
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            Id = Intent.GetIntExtra("id", 0);
            questionPresenter = new QuestionPresenter(this);
            handler           = new Handler();

            StatusBarCompat.SetOrdinaryToolBar(this);
            toolbar = FindViewById <Toolbar>(Resource.Id.toolbar);
            toolbar.SetNavigationIcon(Resource.Drawable.back_24dp);
            SetSupportActionBar(toolbar);
            SupportActionBar.SetDisplayHomeAsUpEnabled(true);
            toolbar.SetNavigationOnClickListener(this);
            toolbar.SetOnMenuItemClickListener(this);

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

            txtTitle     = FindViewById <TextView>(Resource.Id.txtTitle);
            imgIconName  = FindViewById <ImageView>(Resource.Id.imgIconName);
            txtUserName  = FindViewById <TextView>(Resource.Id.txtUserName);
            txtScore     = FindViewById <TextView>(Resource.Id.txtScore);
            txtDateAdded = FindViewById <TextView>(Resource.Id.txtDateAdded);
            txtGold      = FindViewById <TextView>(Resource.Id.txtGold);
            txtDealFlag  = FindViewById <TextView>(Resource.Id.txtDealFlag);
            txtTag       = FindViewById <TextView>(Resource.Id.txtTag);
            this.txtDealFlag.Selected = true;
            txtBody = FindViewById <WebView>(Resource.Id.txtBody);
            txtBody.Settings.JavaScriptEnabled        = true;
            txtBody.Settings.DomStorageEnabled        = true;
            txtBody.Settings.LoadsImagesAutomatically = true;
            txtBody.Settings.DefaultTextEncodingName  = "utf-8";
            txtBody.SetWebViewClient(BodyWebViewClient.With(this));
            txtBody.ScrollBarStyle = ScrollbarStyles.InsideOverlay;
            txtBody.Settings.SetSupportZoom(false);
            txtBody.Settings.BuiltInZoomControls = false;
            txtBody.Settings.CacheMode           = CacheModes.CacheElseNetwork;
            txtBody.Settings.SetLayoutAlgorithm(WebSettings.LayoutAlgorithm.SingleColumn);
            var jsInterface = new WebViewJSInterface(this);

            txtBody.AddJavascriptInterface(jsInterface, "openlistner");
            jsInterface.CallFromPageReceived += delegate(object sender, WebViewJSInterface.CallFromPageReceivedEventArgs e)
            {
                PhotoActivity.Start(this, e.Result.Split(','), e.Index);
            };
            txtDigg          = FindViewById <TextView>(Resource.Id.txtDigg);
            txtRead          = FindViewById <TextView>(Resource.Id.txtRead);
            txtBookmark      = FindViewById <TextView>(Resource.Id.txtBookmark);
            txtComments      = FindViewById <TextView>(Resource.Id.txtComments);
            txtComments.Text = Resources.GetString(Resource.String.answer);

            (txtComments.Parent as FrameLayout).Click += delegate
            {
                if (question != null && question.Qid > 0)
                {
                    QuestionAnswersActivity.Start(this, question.Qid);
                }
            };
            (txtBookmark.Parent as FrameLayout).Click += delegate
            {
                if (question != null && question.Qid > 0)
                {
                    var linkurl = "https://q.cnblogs.com/q/" + question.Qid + "/";
                    var title   = question.Title + "_²©ÎÊ_²©¿ÍÔ°";
                    BookmarkAddActivity.Start(this, linkurl, title, true);
                }
            };
            swipeRefreshLayout.Post(async() =>
            {
                await questionPresenter.GetClientQuestion(Id);
            });
            shareAction = new ShareAction(this).SetDisplayList(SHARE_MEDIA.Weixin, SHARE_MEDIA.WeixinCircle, SHARE_MEDIA.WeixinFavorite, SHARE_MEDIA.Sina).SetShareboardclickCallback(this);
        }