Moved the declare-styleable attributes to fluentui_core attrs.xml & enum attributes to fluentui_topappbars attrs.xml to reuse at module level. Attributes also prefixed with 'fluentui_' to avoid conflict with other UI library attributes

This commit is contained in:
Mayank Mishra 2022-02-13 22:04:01 +05:30 коммит произвёл mishramayank1
Родитель 402314b291
Коммит 3750aa794b
5 изменённых файлов: 25 добавлений и 9 удалений

Просмотреть файл

@ -18,7 +18,7 @@
android:id="@+id/app_bar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:scrollBehavior="pin" />
app:fluentui_scrollBehavior="pin" />
<androidx.core.widget.NestedScrollView
android:id="@+id/demo_detail_scrollable_container"

Просмотреть файл

@ -34,6 +34,7 @@
<!--Transparent Foregrounds-->
<attr name="fluentuiForegroundOnPrimary80Color" format="reference|color"/>
<attr name="fluentuiForegroundOnPrimary70Color" format="reference|color"/>
<<<<<<< HEAD
<!--Attributes from Modules-->
@ -146,4 +147,13 @@
<attr name="fluentui_tabUnselectedTextColor" format="color" />
<!--fluentui_tablayout End-->
||||||| parent of 2dc6d10 (Moved the declare-styleable attributes to fluentui_core attrs.xml & enum attributes to fluentui_topappbars attrs.xml to reuse at module level. Attributes also prefixed with 'fluentui_' to avoid conflict with other UI library attributes)
=======
<!--fluentui_topappbars Start-->
<!--AppBarLayout-->
<attr name="fluentui_scrollTargetViewId" format="integer" />
<!--fluentui_topappbars End-->
>>>>>>> 2dc6d10 (Moved the declare-styleable attributes to fluentui_core attrs.xml & enum attributes to fluentui_topappbars attrs.xml to reuse at module level. Attributes also prefixed with 'fluentui_' to avoid conflict with other UI library attributes)
</resources>

Просмотреть файл

@ -126,8 +126,8 @@ class AppBarLayout : AppBarLayout {
setBackgroundColor(ThemeUtil.getThemeAttrColor(context, R.attr.fluentuiAppBarLayoutBackgroundColor))
val styledAttributes = context.obtainStyledAttributes(attrs, R.styleable.AppBarLayout)
scrollTargetViewId = styledAttributes.getResourceId(R.styleable.AppBarLayout_scrollTargetViewId, View.NO_ID)
val scrollBehaviorOrdinal = styledAttributes.getInt(R.styleable.AppBarLayout_scrollBehavior, DEFAULT_SCROLL_BEHAVIOR.ordinal)
scrollTargetViewId = styledAttributes.getResourceId(R.styleable.AppBarLayout_fluentui_scrollTargetViewId, View.NO_ID)
val scrollBehaviorOrdinal = styledAttributes.getInt(R.styleable.AppBarLayout_fluentui_scrollBehavior, DEFAULT_SCROLL_BEHAVIOR.ordinal)
scrollBehavior = ScrollBehavior.values()[scrollBehaviorOrdinal]
styledAttributes.recycle()
}

Просмотреть файл

@ -28,4 +28,14 @@
<attr name="fluentuiToolbarSubtitleTextColor" format="reference|color"/>
<attr name="fluentuiToolbarIconColor" format="reference|color"/>
<!--common fluentui_topappbars Module attributes-->
<!--AppBarLayout-->
<attr name="fluentui_scrollBehavior" format="enum">
<enum name="none" value="0" />
<enum name="collapseToolbar" value="1" />
<enum name="pin" value="2" />
</attr>
</resources>

Просмотреть файл

@ -6,11 +6,7 @@
<resources>
<declare-styleable name="AppBarLayout">
<attr name="scrollTargetViewId" format="integer" />
<attr name="scrollBehavior" format="enum">
<enum name="none" value="0" />
<enum name="collapseToolbar" value="1" />
<enum name="pin" value="2" />
</attr>
<attr name="fluentui_scrollTargetViewId"/>
<attr name="fluentui_scrollBehavior"/>
</declare-styleable>
</resources>