Skip to content

Commit

Permalink
Add custom fonts
Browse files Browse the repository at this point in the history
  • Loading branch information
furkanakdemir committed Oct 2, 2019
1 parent 090422b commit 3bc389f
Show file tree
Hide file tree
Showing 9 changed files with 50 additions and 15 deletions.
Binary file modified art/noticeboard_activity.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified art/noticeboard_dialog.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ internal class NoticeBoardDialogFragment : DialogFragment() {
private val noticeBoardViewModel by viewModels<NoticeBoardViewModel>()

override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
val builder = AlertDialog.Builder(requireContext())
val builder = AlertDialog.Builder(requireContext(), R.style.NoticeBoard_Dialog)

val title = arguments?.getString(KEY_TITLE, TITLE_DEFAULT)

Expand Down
17 changes: 12 additions & 5 deletions noticeboard/src/main/res/font/noticeboard_font_family.xml
Original file line number Diff line number Diff line change
@@ -1,13 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<font-family xmlns:app="http://schemas.android.com/apk/res-auto">
<font-family xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:android="http://schemas.android.com/apk/res/android">
<font
android:font="@font/montserrat_medium"
android:fontStyle="normal"
android:fontWeight="500"
app:font="@font/montserrat_regular"
app:fontStyle="normal"
app:fontWeight="400"
app:font="@font/montserrat_regular" />
app:fontWeight="400" />

<font
android:font="@font/montserrat_medium"
android:fontStyle="normal"
android:fontWeight="500"
app:font="@font/montserrat_medium"
app:fontStyle="normal"
app:fontWeight="400"
app:font="@font/montserrat_medium" />
app:fontWeight="500" />

</font-family>
2 changes: 2 additions & 0 deletions noticeboard/src/main/res/layout/activity_notice_board.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
android:elevation="4dp"
app:titleTextAppearance="@style/NoticeBoard.Toolbar"
app:popupTheme="@style/NoticeBoardTheme.PopupOverlay" />
</com.google.android.material.appbar.AppBarLayout>

Expand Down Expand Up @@ -47,6 +48,7 @@
android:id="@+id/messageTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
style="@style/NoticeBoard.Message"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
Expand Down
5 changes: 1 addition & 4 deletions noticeboard/src/main/res/layout/list_item_change_log.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
android:id="@+id/change_type"
style="@style/NoticeBoard.Change.Type"
android:layout_width="0dp"
android:fontFamily="@font/montserrat_medium"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/notice_board_spacing_small"
android:elevation="@dimen/elevation_change_log_change_type"
Expand All @@ -29,9 +28,7 @@
android:paddingStart="@dimen/notice_board_spacing_small"
android:paddingEnd="@dimen/notice_board_spacing_small"
app:layout_constraintBottom_toBottomOf="parent"
android:fontFamily="@font/montserrat_regular"
app:layout_constraintEnd_toEndOf="parent"
android:fontFamily="@font/montserrat_regular"
app:layout_constraintStart_toStartOf="@+id/guideline"
app:layout_constraintTop_toTopOf="parent"
tools:text="@tools:sample/lorem/random" />
Expand All @@ -41,5 +38,5 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
app:layout_constraintGuide_begin="96dp" />
app:layout_constraintGuide_begin="@dimen/guideline_list_item_change_log_start" />
</androidx.constraintlayout.widget.ConstraintLayout>
3 changes: 3 additions & 0 deletions noticeboard/src/main/res/values/dimens.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,13 @@

<!-- Header -->
<dimen name="notice_board_height_header">56dp</dimen>

<dimen name="width_dialog">360dp</dimen>
<dimen name="height_dialog">600dp</dimen>

<dimen name="height_list_item_change_log_min">56dp</dimen>
<dimen name="elevation_change_log_change_type">4dp</dimen>

<dimen name="guideline_list_item_change_log_start">104dp</dimen>

</resources>
28 changes: 26 additions & 2 deletions noticeboard/src/main/res/values/styles.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
<item name="colorPrimary">@color/noticeBoardColorPrimary</item>
<item name="colorPrimaryDark">@color/noticeBoardColorPrimaryDark</item>
<item name="colorAccent">@color/noticeBoardColorAccent</item>

</style>

<style name="NoticeBoardTheme.NoActionBar">
Expand All @@ -18,6 +19,29 @@
<style name="NoticeBoard" />


<!-- Toolbar -->

<style name="NoticeBoard.Toolbar">
<item name="fontFamily">@font/montserrat_medium</item>
<item name="android:textSize">16sp</item>
</style>

<!-- Message -->

<style name="NoticeBoard.Message">
<item name="fontFamily">@font/montserrat_medium</item>
<item name="android:textSize">16sp</item>
</style>

<!-- Dialog -->

<style name="NoticeBoard.Dialog" parent="@style/ThemeOverlay.MaterialComponents.Dialog.Alert">
<item name="fontFamily">@font/montserrat_medium</item>
<item name="android:colorAccent">@color/noticeBoardColorAccent</item>
<item name="colorAccent">@color/noticeBoardColorAccent</item>
</style>


<!-- Header Styles-->

<style name="NoticeBoard.Header" />
Expand All @@ -29,10 +53,9 @@
</style>

<style name="NoticeBoard.Header.Date">

<item name="android:textAppearance">@style/TextAppearance.MaterialComponents.Headline6
</item>

<item name="android:fontFamily">@font/montserrat_medium</item>
</style>

<style name="NoticeBoard.Header.Version">
Expand All @@ -55,6 +78,7 @@
<item name="android:gravity">center</item>
<item name="android:textColor">@color/notice_board_change_type_text_default</item>
<item name="android:textSize">12sp</item>
<item name="android:fontFamily">@font/montserrat_medium</item>
</style>

<style name="NoticeBoard.Change.Description">
Expand Down
8 changes: 5 additions & 3 deletions sample/src/main/res/values/styles.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<resources>

<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<style name="AppTheme" parent="Theme.MaterialComponents.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
Expand All @@ -11,7 +11,9 @@
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
</style>
<style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar"/>
<style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light"/>

<style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.MaterialComponents.Dark.ActionBar" />

<style name="AppTheme.PopupOverlay" parent="ThemeOverlay.MaterialComponents.Light" />

</resources>

0 comments on commit 3bc389f

Please sign in to comment.