コード例 #1
0
        static Style()
        {
            Light        = Typeface.CreateFromAsset(Application.Context.Assets, "OpenSans-Light.ttf");
            Regular      = Typeface.CreateFromAsset(Application.Context.Assets, "OpenSans-Regular.ttf");
            Semibold     = Typeface.CreateFromAsset(Application.Context.Assets, "OpenSans-Semibold.ttf");
            R15G24B30    = BitmapUtils.GetColorFromInteger(ContextCompat.GetColor(Application.Context, Resource.Color.rgb15_24_30));
            R151G155B158 = BitmapUtils.GetColorFromInteger(ContextCompat.GetColor(Application.Context, Resource.Color.rgb151_155_158));
            R244G244B246 = BitmapUtils.GetColorFromInteger(ContextCompat.GetColor(Application.Context, Resource.Color.rgb244_244_246));
            R231G72B00   = BitmapUtils.GetColorFromInteger(ContextCompat.GetColor(Application.Context, Resource.Color.rgb231_72_0));
            R255G121B4   = BitmapUtils.GetColorFromInteger(ContextCompat.GetColor(Application.Context, Resource.Color.rgb255_121_4));
            R255G22B5    = BitmapUtils.GetColorFromInteger(ContextCompat.GetColor(Application.Context, Resource.Color.rgb255_22_5));
            R255G34B5    = BitmapUtils.GetColorFromInteger(ContextCompat.GetColor(Application.Context, Resource.Color.rgb255_34_5));
            R209G213B216 = BitmapUtils.GetColorFromInteger(ContextCompat.GetColor(Application.Context, Resource.Color.rgb209_213_216));
            R255G81B4    = BitmapUtils.GetColorFromInteger(ContextCompat.GetColor(Application.Context, Resource.Color.rgb255_81_4));
            R245G245B245 = BitmapUtils.GetColorFromInteger(ContextCompat.GetColor(Application.Context, Resource.Color.rgb245_245_245));
            R254G249B229 = BitmapUtils.GetColorFromInteger(ContextCompat.GetColor(Application.Context, Resource.Color.rgb254_249_229));

            Density                  = Application.Context.Resources.DisplayMetrics.Density;
            TopPanelHeightInDp       = Application.Context.Resources.GetDimension(Resource.Dimension.dp_top_panel_height) / Density;
            TabBarHeightInDp         = Application.Context.Resources.GetDimension(Resource.Dimension.dp_tab_bar_height) / Density;
            FeedItemHeaderHeightInDp = Application.Context.Resources.GetDimension(Resource.Dimension.dp_feed_item_header_height) / Density;
            ScreenHeightInDp         = Application.Context.Resources.DisplayMetrics.HeightPixels / Density;
            ScreenWidthInDp          = Application.Context.Resources.DisplayMetrics.WidthPixels / Density;
            MaxPostHeight            = ScreenHeightInDp - TopPanelHeightInDp - FeedItemHeaderHeightInDp - TabBarHeightInDp - 54;
        }
コード例 #2
0
ファイル: Style.cs プロジェクト: donchate/steepshot-mobile
        static Style()
        {
            Light        = Typeface.CreateFromAsset(Application.Context.Assets, "OpenSans-Light.ttf");
            Regular      = Typeface.CreateFromAsset(Application.Context.Assets, "OpenSans-Regular.ttf");
            Semibold     = Typeface.CreateFromAsset(Application.Context.Assets, "OpenSans-Semibold.ttf");
            R15G24B30    = BitmapUtils.GetColorFromInteger(ContextCompat.GetColor(Application.Context, Resource.Color.rgb15_24_30));
            R151G155B158 = BitmapUtils.GetColorFromInteger(ContextCompat.GetColor(Application.Context, Resource.Color.rgb151_155_158));
            R244G244B246 = BitmapUtils.GetColorFromInteger(ContextCompat.GetColor(Application.Context, Resource.Color.rgb244_244_246));
            R231G72B00   = BitmapUtils.GetColorFromInteger(ContextCompat.GetColor(Application.Context, Resource.Color.rgb231_72_0));
            R255G121B4   = BitmapUtils.GetColorFromInteger(ContextCompat.GetColor(Application.Context, Resource.Color.rgb255_121_4));
            R255G22B5    = BitmapUtils.GetColorFromInteger(ContextCompat.GetColor(Application.Context, Resource.Color.rgb255_22_5));
            R255G34B5    = BitmapUtils.GetColorFromInteger(ContextCompat.GetColor(Application.Context, Resource.Color.rgb255_34_5));
            R209G213B216 = BitmapUtils.GetColorFromInteger(ContextCompat.GetColor(Application.Context, Resource.Color.rgb209_213_216));
            R255G81B4    = BitmapUtils.GetColorFromInteger(ContextCompat.GetColor(Application.Context, Resource.Color.rgb255_81_4));
            R245G245B245 = BitmapUtils.GetColorFromInteger(ContextCompat.GetColor(Application.Context, Resource.Color.rgb245_245_245));
            R254G249B229 = BitmapUtils.GetColorFromInteger(ContextCompat.GetColor(Application.Context, Resource.Color.rgb254_249_229));
            R230G230B230 = BitmapUtils.GetColorFromInteger(ContextCompat.GetColor(Application.Context, Resource.Color.rgb230_230_230));

            Density = Application.Context.Resources.DisplayMetrics.Density;

            var topPanelHeight       = Application.Context.Resources.GetDimension(Resource.Dimension.dp_top_panel_height);
            var tabBarHeight         = Application.Context.Resources.GetDimension(Resource.Dimension.dp_tab_bar_height);
            var feedItemHeaderHeight = Application.Context.Resources.GetDimension(Resource.Dimension.dp_feed_item_header_height);

            PostPagerMargin = (int)Application.Context.Resources.GetDimension(Resource.Dimension.dp_post_pager_margin);

            ScreenHeight = Application.Context.Resources.DisplayMetrics.HeightPixels;
            ScreenWidth  = Application.Context.Resources.DisplayMetrics.WidthPixels;

            PagerScreenWidth = ScreenWidth - PostPagerMargin * 4;
            MaxPostHeight    = ScreenHeight - topPanelHeight - feedItemHeaderHeight - tabBarHeight - 54 * Density;

            GalleryHorizontalScreenWidth = (int)(ScreenWidth - 25 * Density);
            GalleryHorizontalHeight      = (int)(160 * Density);
            KeyboardVisibilityThreshold  = (int)(128 * Density);
            CornerRadius5 = 5 * Density;
            Margin10      = (int)(10 * Density);
            Margin15      = (int)(15 * Density);
        }