├── .idea
├── .name
├── codeStyles
│ ├── codeStyleConfig.xml
│ └── Project.xml
├── vcs.xml
├── runConfigurations.xml
├── misc.xml
├── checkstyle-idea.xml
├── copyright
│ └── apache_2_0.xml
├── gradle.xml
└── jarRepositories.xml
├── app
├── .gitignore
├── src
│ └── main
│ │ ├── ic_launcher-playstore.png
│ │ ├── res
│ │ ├── drawable-nodpi
│ │ │ ├── fox.jpg
│ │ │ ├── hay.jpg
│ │ │ ├── city.jpg
│ │ │ ├── mountain.jpg
│ │ │ ├── timber.jpg
│ │ │ └── turtle.jpg
│ │ ├── mipmap-hdpi
│ │ │ ├── ic_launcher.png
│ │ │ ├── ic_launcher_round.png
│ │ │ ├── ic_launcher_background.png
│ │ │ └── ic_launcher_foreground.png
│ │ ├── mipmap-mdpi
│ │ │ ├── ic_launcher.png
│ │ │ ├── ic_launcher_round.png
│ │ │ ├── ic_launcher_background.png
│ │ │ └── ic_launcher_foreground.png
│ │ ├── mipmap-xhdpi
│ │ │ ├── ic_launcher.png
│ │ │ ├── ic_launcher_round.png
│ │ │ ├── ic_launcher_background.png
│ │ │ └── ic_launcher_foreground.png
│ │ ├── mipmap-xxhdpi
│ │ │ ├── ic_launcher.png
│ │ │ ├── ic_launcher_round.png
│ │ │ ├── ic_launcher_background.png
│ │ │ └── ic_launcher_foreground.png
│ │ ├── mipmap-xxxhdpi
│ │ │ ├── ic_launcher.png
│ │ │ ├── ic_launcher_round.png
│ │ │ ├── ic_launcher_background.png
│ │ │ └── ic_launcher_foreground.png
│ │ ├── values
│ │ │ ├── preloaded_fonts.xml
│ │ │ ├── dimens.xml
│ │ │ ├── colors.xml
│ │ │ ├── themes.xml
│ │ │ ├── font_certs.xml
│ │ │ ├── strings.xml
│ │ │ └── styles.xml
│ │ ├── values-w600dp
│ │ │ └── dimens.xml
│ │ ├── drawable
│ │ │ ├── bg_edit_text.xml
│ │ │ ├── ic_default_grid.xml
│ │ │ ├── ic_favourite_state.xml
│ │ │ ├── ic_home_24.xml
│ │ │ ├── ic_navigation_24.xml
│ │ │ ├── ic_typography_24.xml
│ │ │ ├── ic_bookmark_24.xml
│ │ │ ├── ic_view_24.xml
│ │ │ ├── ic_staggered_grid_24.xml
│ │ │ ├── ic_grid_24.xml
│ │ │ ├── ic_input_24.xml
│ │ │ ├── ic_error_24.xml
│ │ │ ├── ic_favourite_filled_24.xml
│ │ │ ├── ic_notifications_24.xml
│ │ │ ├── ic_dialog_24.xml
│ │ │ ├── ic_explore_articles_24.xml
│ │ │ ├── ic_search_24.xml
│ │ │ ├── ic_lock_24.xml
│ │ │ ├── ic_favourite_outline_24.xml
│ │ │ ├── ic_animation_24.xml
│ │ │ ├── ic_color_palette_24.xml
│ │ │ ├── ic_motion_24.xml
│ │ │ ├── ic_settings_24.xml
│ │ │ └── ic_launcher_background.xml
│ │ ├── mipmap-anydpi-v26
│ │ │ ├── ic_launcher.xml
│ │ │ └── ic_launcher_round.xml
│ │ ├── color
│ │ │ ├── bottom_nav_state.xml
│ │ │ └── bg_toggle_state.xml
│ │ ├── font
│ │ │ └── dancing_script.xml
│ │ ├── layout
│ │ │ ├── item_input_dropdown.xml
│ │ │ ├── fragment_lottie.xml
│ │ │ ├── activity_main.xml
│ │ │ ├── fragment_typography_demo.xml
│ │ │ ├── fragment_bottom_navigation.xml
│ │ │ ├── fragment_home.xml
│ │ │ ├── fragment_buttons.xml
│ │ │ ├── fragment_motion_layout.xml
│ │ │ ├── fragment_object_animator.xml
│ │ │ ├── fragment_value_animations.xml
│ │ │ ├── item_grid.xml
│ │ │ ├── item_grid_linear.xml
│ │ │ ├── fragment_typography.xml
│ │ │ ├── item_grid_staggered.xml
│ │ │ ├── item_home_category.xml
│ │ │ ├── fragment_animator_set.xml
│ │ │ ├── view_material_dialog.xml
│ │ │ ├── fragment_grids.xml
│ │ │ ├── fragment_material_dialogs.xml
│ │ │ ├── fragment_animations.xml
│ │ │ ├── fragment_floating_action_button.xml
│ │ │ ├── fragment_layout_transition.xml
│ │ │ ├── item_typography_demo.xml
│ │ │ └── fragment_typography_reference.xml
│ │ ├── menu
│ │ │ └── bottom_navigation_menu.xml
│ │ ├── anim
│ │ │ ├── slide_in_left.xml
│ │ │ ├── slide_out_right.xml
│ │ │ ├── slide_in_right.xml
│ │ │ └── slide_out_left.xml
│ │ ├── drawable-v24
│ │ │ └── ic_launcher_foreground.xml
│ │ └── xml
│ │ │ └── motion_scene.xml
│ │ ├── java
│ │ └── com
│ │ │ └── github
│ │ │ └── odaridavid
│ │ │ └── materialx
│ │ │ ├── animations
│ │ │ ├── LottieFragment.kt
│ │ │ ├── AnimationsFragment.kt
│ │ │ ├── ObjectAnimatorFragment.kt
│ │ │ ├── AnimatorListener.kt
│ │ │ ├── ValueAnimatorFragment.kt
│ │ │ ├── LayoutTransitionFragment.kt
│ │ │ └── AnimatorSetFragment.kt
│ │ │ ├── motion
│ │ │ └── MotionLayoutFragment.kt
│ │ │ ├── typography
│ │ │ ├── TypographyReferenceFragment.kt
│ │ │ ├── TypographyDemo.kt
│ │ │ ├── TypographyDemoFragment.kt
│ │ │ ├── TypographyFragment.kt
│ │ │ ├── TypographyDataGenerator.kt
│ │ │ └── TypographyDemoAdapter.kt
│ │ │ ├── colorpalette
│ │ │ ├── PaletteUtils.kt
│ │ │ └── ColorPaletteFragment.kt
│ │ │ ├── commons
│ │ │ ├── SdkUtils.kt
│ │ │ ├── ContextExtensions.kt
│ │ │ ├── FragmentExtensions.kt
│ │ │ └── AlertDialogExtensions.kt
│ │ │ ├── grids
│ │ │ ├── GridItem.kt
│ │ │ ├── GridAdapter.kt
│ │ │ └── GridsFragment.kt
│ │ │ ├── buttons
│ │ │ ├── ButtonsFragment.kt
│ │ │ ├── MaterialButtonsFragment.kt
│ │ │ └── FloatingActionButtonFragment.kt
│ │ │ ├── HomeFragment.kt
│ │ │ ├── input
│ │ │ └── InputFragment.kt
│ │ │ ├── customview
│ │ │ └── MaterialXImageView.kt
│ │ │ ├── HomeCategory.kt
│ │ │ ├── bottomnav
│ │ │ └── BottomNavFragment.kt
│ │ │ ├── HomeCategoryAdapter.kt
│ │ │ ├── MainActivity.kt
│ │ │ └── dialogs
│ │ │ └── MaterialDialogsFragment.kt
│ │ └── AndroidManifest.xml
├── proguard-rules.pro
└── build.gradle
├── settings.gradle
├── art
├── as.gif
├── cp1.png
├── cp2.png
├── it.gif
├── mb.png
├── oa.gif
├── va.gif
├── bnav.png
├── fabs.gif
├── grida.png
├── gridb.png
├── gridc.png
├── input.png
├── lottie.gif
├── motion.gif
├── dialog1.png
├── dialog2.png
├── dialog3.png
├── dialog4.png
├── dialog5.png
├── typography.png
└── typography3.png
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── .gitignore
├── gradle.properties
├── gradlew.bat
├── README.md
└── gradlew
/.idea/.name:
--------------------------------------------------------------------------------
1 | Material-X
--------------------------------------------------------------------------------
/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app'
2 | rootProject.name = "Material-X"
--------------------------------------------------------------------------------
/art/as.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/odaridavid/Material-Design-Android/HEAD/art/as.gif
--------------------------------------------------------------------------------
/art/cp1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/odaridavid/Material-Design-Android/HEAD/art/cp1.png
--------------------------------------------------------------------------------
/art/cp2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/odaridavid/Material-Design-Android/HEAD/art/cp2.png
--------------------------------------------------------------------------------
/art/it.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/odaridavid/Material-Design-Android/HEAD/art/it.gif
--------------------------------------------------------------------------------
/art/mb.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/odaridavid/Material-Design-Android/HEAD/art/mb.png
--------------------------------------------------------------------------------
/art/oa.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/odaridavid/Material-Design-Android/HEAD/art/oa.gif
--------------------------------------------------------------------------------
/art/va.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/odaridavid/Material-Design-Android/HEAD/art/va.gif
--------------------------------------------------------------------------------
/art/bnav.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/odaridavid/Material-Design-Android/HEAD/art/bnav.png
--------------------------------------------------------------------------------
/art/fabs.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/odaridavid/Material-Design-Android/HEAD/art/fabs.gif
--------------------------------------------------------------------------------
/art/grida.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/odaridavid/Material-Design-Android/HEAD/art/grida.png
--------------------------------------------------------------------------------
/art/gridb.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/odaridavid/Material-Design-Android/HEAD/art/gridb.png
--------------------------------------------------------------------------------
/art/gridc.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/odaridavid/Material-Design-Android/HEAD/art/gridc.png
--------------------------------------------------------------------------------
/art/input.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/odaridavid/Material-Design-Android/HEAD/art/input.png
--------------------------------------------------------------------------------
/art/lottie.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/odaridavid/Material-Design-Android/HEAD/art/lottie.gif
--------------------------------------------------------------------------------
/art/motion.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/odaridavid/Material-Design-Android/HEAD/art/motion.gif
--------------------------------------------------------------------------------
/art/dialog1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/odaridavid/Material-Design-Android/HEAD/art/dialog1.png
--------------------------------------------------------------------------------
/art/dialog2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/odaridavid/Material-Design-Android/HEAD/art/dialog2.png
--------------------------------------------------------------------------------
/art/dialog3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/odaridavid/Material-Design-Android/HEAD/art/dialog3.png
--------------------------------------------------------------------------------
/art/dialog4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/odaridavid/Material-Design-Android/HEAD/art/dialog4.png
--------------------------------------------------------------------------------
/art/dialog5.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/odaridavid/Material-Design-Android/HEAD/art/dialog5.png
--------------------------------------------------------------------------------
/art/typography.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/odaridavid/Material-Design-Android/HEAD/art/typography.png
--------------------------------------------------------------------------------
/art/typography3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/odaridavid/Material-Design-Android/HEAD/art/typography3.png
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/odaridavid/Material-Design-Android/HEAD/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/app/src/main/ic_launcher-playstore.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/odaridavid/Material-Design-Android/HEAD/app/src/main/ic_launcher-playstore.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-nodpi/fox.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/odaridavid/Material-Design-Android/HEAD/app/src/main/res/drawable-nodpi/fox.jpg
--------------------------------------------------------------------------------
/app/src/main/res/drawable-nodpi/hay.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/odaridavid/Material-Design-Android/HEAD/app/src/main/res/drawable-nodpi/hay.jpg
--------------------------------------------------------------------------------
/app/src/main/res/drawable-nodpi/city.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/odaridavid/Material-Design-Android/HEAD/app/src/main/res/drawable-nodpi/city.jpg
--------------------------------------------------------------------------------
/app/src/main/res/drawable-nodpi/mountain.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/odaridavid/Material-Design-Android/HEAD/app/src/main/res/drawable-nodpi/mountain.jpg
--------------------------------------------------------------------------------
/app/src/main/res/drawable-nodpi/timber.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/odaridavid/Material-Design-Android/HEAD/app/src/main/res/drawable-nodpi/timber.jpg
--------------------------------------------------------------------------------
/app/src/main/res/drawable-nodpi/turtle.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/odaridavid/Material-Design-Android/HEAD/app/src/main/res/drawable-nodpi/turtle.jpg
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/odaridavid/Material-Design-Android/HEAD/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/odaridavid/Material-Design-Android/HEAD/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/odaridavid/Material-Design-Android/HEAD/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/odaridavid/Material-Design-Android/HEAD/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/odaridavid/Material-Design-Android/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/odaridavid/Material-Design-Android/HEAD/app/src/main/res/mipmap-hdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/odaridavid/Material-Design-Android/HEAD/app/src/main/res/mipmap-mdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/odaridavid/Material-Design-Android/HEAD/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/odaridavid/Material-Design-Android/HEAD/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/odaridavid/Material-Design-Android/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher_background.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/odaridavid/Material-Design-Android/HEAD/app/src/main/res/mipmap-hdpi/ic_launcher_background.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/odaridavid/Material-Design-Android/HEAD/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher_background.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/odaridavid/Material-Design-Android/HEAD/app/src/main/res/mipmap-mdpi/ic_launcher_background.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/odaridavid/Material-Design-Android/HEAD/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher_background.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/odaridavid/Material-Design-Android/HEAD/app/src/main/res/mipmap-xhdpi/ic_launcher_background.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/odaridavid/Material-Design-Android/HEAD/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher_background.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/odaridavid/Material-Design-Android/HEAD/app/src/main/res/mipmap-xxhdpi/ic_launcher_background.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/odaridavid/Material-Design-Android/HEAD/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher_background.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/odaridavid/Material-Design-Android/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_launcher_background.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/odaridavid/Material-Design-Android/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png
--------------------------------------------------------------------------------
/.idea/codeStyles/codeStyleConfig.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/res/values/preloaded_fonts.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | - @font/dancing_script
5 |
6 |
7 |
--------------------------------------------------------------------------------
/app/src/main/res/values-w600dp/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 288dp
4 | 240dp
5 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | *.iml
2 | .gradle
3 | /local.properties
4 | /.idea/caches
5 | /.idea/libraries
6 | /.idea/modules.xml
7 | /.idea/workspace.xml
8 | /.idea/navEditor.xml
9 | /.idea/assetWizardSettings.xml
10 | .DS_Store
11 | /build
12 | /captures
13 | .externalNativeBuild
14 | .cxx
15 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Wed Jun 17 23:59:52 EAT 2020
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip
7 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/bg_edit_text.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/app/src/main/res/color/bottom_nav_state.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/app/src/main/res/color/bg_toggle_state.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/res/font/dancing_script.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_default_grid.xml:
--------------------------------------------------------------------------------
1 |
7 |
10 |
11 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_favourite_state.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_home_24.xml:
--------------------------------------------------------------------------------
1 |
7 |
10 |
11 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_navigation_24.xml:
--------------------------------------------------------------------------------
1 |
7 |
10 |
11 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_typography_24.xml:
--------------------------------------------------------------------------------
1 |
7 |
10 |
11 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_bookmark_24.xml:
--------------------------------------------------------------------------------
1 |
7 |
10 |
11 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_view_24.xml:
--------------------------------------------------------------------------------
1 |
7 |
10 |
11 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_staggered_grid_24.xml:
--------------------------------------------------------------------------------
1 |
7 |
10 |
11 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_grid_24.xml:
--------------------------------------------------------------------------------
1 |
7 |
10 |
11 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_input_24.xml:
--------------------------------------------------------------------------------
1 |
7 |
10 |
11 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_error_24.xml:
--------------------------------------------------------------------------------
1 |
7 |
10 |
11 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/item_input_dropdown.xml:
--------------------------------------------------------------------------------
1 |
2 |
13 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_favourite_filled_24.xml:
--------------------------------------------------------------------------------
1 |
7 |
10 |
11 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_notifications_24.xml:
--------------------------------------------------------------------------------
1 |
7 |
10 |
11 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_dialog_24.xml:
--------------------------------------------------------------------------------
1 |
7 |
10 |
11 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_explore_articles_24.xml:
--------------------------------------------------------------------------------
1 |
7 |
10 |
11 |
--------------------------------------------------------------------------------
/.idea/runConfigurations.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_search_24.xml:
--------------------------------------------------------------------------------
1 |
7 |
10 |
11 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_lock_24.xml:
--------------------------------------------------------------------------------
1 |
7 |
10 |
11 |
--------------------------------------------------------------------------------
/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/.idea/checkstyle-idea.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_favourite_outline_24.xml:
--------------------------------------------------------------------------------
1 |
7 |
10 |
11 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_animation_24.xml:
--------------------------------------------------------------------------------
1 |
7 |
10 |
11 |
--------------------------------------------------------------------------------
/app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # You can control the set of applied configuration files using the
3 | # proguardFiles setting in build.gradle.
4 | #
5 | # For more details, see
6 | # http://developer.android.com/guide/developing/tools/proguard.html
7 |
8 | # If your project uses WebView with JS, uncomment the following
9 | # and specify the fully qualified class name to the JavaScript interface
10 | # class:
11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12 | # public *;
13 | #}
14 |
15 | # Uncomment this to preserve the line number information for
16 | # debugging stack traces.
17 | #-keepattributes SourceFile,LineNumberTable
18 |
19 | # If you keep the line number information, uncomment this to
20 | # hide the original source file name.
21 | #-renamesourcefileattribute SourceFile
--------------------------------------------------------------------------------
/app/src/main/res/layout/fragment_lottie.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
18 |
19 |
--------------------------------------------------------------------------------
/.idea/copyright/apache_2_0.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_color_palette_24.xml:
--------------------------------------------------------------------------------
1 |
7 |
10 |
11 |
--------------------------------------------------------------------------------
/app/src/main/java/com/github/odaridavid/materialx/animations/LottieFragment.kt:
--------------------------------------------------------------------------------
1 | /**
2 | *
3 | * Copyright 2020 David Odari
4 | *
5 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
6 | * in compliance with the License. You may obtain a copy of the License at
7 | * http://www.apache.org/licenses/LICENSE-2.0
8 | * Unless required by applicable law or agreed to in writing, software distributed under the License
9 | * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
10 | * or implied. See the License for the specific language governing permissions and limitations under
11 | * the License.
12 | *
13 | **/
14 | package com.github.odaridavid.materialx.animations
15 |
16 | import androidx.fragment.app.Fragment
17 | import com.github.odaridavid.materialx.R
18 |
19 |
20 | internal class LottieFragment : Fragment(R.layout.fragment_lottie)
--------------------------------------------------------------------------------
/app/src/main/java/com/github/odaridavid/materialx/motion/MotionLayoutFragment.kt:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | * Copyright 2020 David Odari
4 | *
5 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
6 | * in compliance with the License. You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software distributed under the License
11 | * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
12 | * or implied. See the License for the specific language governing permissions and limitations under
13 | * the License.
14 | *
15 | */
16 | package com.github.odaridavid.materialx.motion
17 |
18 | import androidx.fragment.app.Fragment
19 | import com.github.odaridavid.materialx.R
20 |
21 |
22 | internal class MotionLayoutFragment : Fragment(R.layout.fragment_motion_layout)
--------------------------------------------------------------------------------
/.idea/gradle.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_motion_24.xml:
--------------------------------------------------------------------------------
1 |
7 |
10 |
11 |
--------------------------------------------------------------------------------
/app/src/main/java/com/github/odaridavid/materialx/typography/TypographyReferenceFragment.kt:
--------------------------------------------------------------------------------
1 | /**
2 | *
3 | * Copyright 2020 David Odari
4 | *
5 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
6 | * in compliance with the License. You may obtain a copy of the License at
7 | * http://www.apache.org/licenses/LICENSE-2.0
8 | * Unless required by applicable law or agreed to in writing, software distributed under the License
9 | * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
10 | * or implied. See the License for the specific language governing permissions and limitations under
11 | * the License.
12 | *
13 | **/
14 | package com.github.odaridavid.materialx.typography
15 |
16 | import androidx.fragment.app.Fragment
17 | import com.github.odaridavid.materialx.R
18 |
19 |
20 | internal class TypographyReferenceFragment : Fragment(R.layout.fragment_typography_reference)
--------------------------------------------------------------------------------
/app/src/main/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 32dp
4 | 16dp
5 | 8dp
6 |
7 |
8 | 48dp
9 | 48dp
10 | 0dp
11 | 4dp
12 | 8dp
13 | 144dp
14 | 120dp
15 | 4dp
16 | 4dp
17 | 0dp
18 | 48dp
19 | 48dp
20 |
21 |
--------------------------------------------------------------------------------
/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/app/src/main/java/com/github/odaridavid/materialx/colorpalette/PaletteUtils.kt:
--------------------------------------------------------------------------------
1 | /**
2 | *
3 | * Copyright 2020 David Odari
4 | *
5 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
6 | * in compliance with the License. You may obtain a copy of the License at
7 | * http://www.apache.org/licenses/LICENSE-2.0
8 | * Unless required by applicable law or agreed to in writing, software distributed under the License
9 | * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
10 | * or implied. See the License for the specific language governing permissions and limitations under
11 | * the License.
12 | *
13 | **/
14 | package com.github.odaridavid.materialx.colorpalette
15 |
16 | import android.graphics.Bitmap
17 | import androidx.palette.graphics.Palette
18 |
19 |
20 | object PaletteUtils {
21 |
22 | fun createPaletteSync(bitmap: Bitmap): Palette = Palette.from(bitmap).generate()
23 |
24 | }
--------------------------------------------------------------------------------
/app/src/main/res/menu/bottom_navigation_menu.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
10 |
11 |
16 |
17 |
22 |
23 |
28 |
29 |
--------------------------------------------------------------------------------
/app/src/main/java/com/github/odaridavid/materialx/typography/TypographyDemo.kt:
--------------------------------------------------------------------------------
1 | /**
2 | *
3 | * Copyright 2020 David Odari
4 | *
5 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
6 | * in compliance with the License. You may obtain a copy of the License at
7 | * http://www.apache.org/licenses/LICENSE-2.0
8 | * Unless required by applicable law or agreed to in writing, software distributed under the License
9 | * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
10 | * or implied. See the License for the specific language governing permissions and limitations under
11 | * the License.
12 | *
13 | **/
14 | package com.github.odaridavid.materialx.typography
15 |
16 | import android.graphics.drawable.Drawable
17 |
18 |
19 | internal data class TypographyDemo(
20 | val image: Drawable,
21 | val imageDescription: String,
22 | val headline: String,
23 | val overline: String,
24 | val body: String,
25 | val caption: String
26 | )
27 |
28 |
29 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
22 |
23 |
--------------------------------------------------------------------------------
/app/src/main/res/anim/slide_in_left.xml:
--------------------------------------------------------------------------------
1 |
16 |
17 |
18 |
19 |
25 |
--------------------------------------------------------------------------------
/app/src/main/res/anim/slide_out_right.xml:
--------------------------------------------------------------------------------
1 |
16 |
17 |
18 |
19 |
25 |
--------------------------------------------------------------------------------
/app/src/main/res/anim/slide_in_right.xml:
--------------------------------------------------------------------------------
1 |
16 |
17 |
18 |
19 |
25 |
26 |
--------------------------------------------------------------------------------
/app/src/main/res/anim/slide_out_left.xml:
--------------------------------------------------------------------------------
1 |
16 |
17 |
18 |
19 |
25 |
26 |
--------------------------------------------------------------------------------
/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | #fafafa
5 | #ffffff
6 | #c7c7c7
7 | #000000
8 |
9 | #424242
10 | #6d6d6d
11 | #1b1b1b
12 | #ffffff
13 |
14 | #ffb74d
15 | #9c27b0
16 |
17 | #880e4f
18 | #560027
19 | #bc477b
20 |
21 | #ffd600
22 | #c7a500
23 | #ffff52
24 |
--------------------------------------------------------------------------------
/app/src/main/java/com/github/odaridavid/materialx/commons/SdkUtils.kt:
--------------------------------------------------------------------------------
1 | /**
2 | *
3 | * Copyright 2020 David Odari
4 | *
5 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
6 | * in compliance with the License. You may obtain a copy of the License at
7 | * http://www.apache.org/licenses/LICENSE-2.0
8 | * Unless required by applicable law or agreed to in writing, software distributed under the License
9 | * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
10 | * or implied. See the License for the specific language governing permissions and limitations under
11 | * the License.
12 | *
13 | **/
14 | package com.github.odaridavid.materialx.commons
15 |
16 | import android.os.Build
17 | import android.os.Build.VERSION.SDK_INT
18 | import androidx.annotation.IntRange
19 |
20 |
21 | internal fun versionFrom(
22 | @IntRange(
23 | from = Build.VERSION_CODES.BASE_1_1.toLong(),
24 | to = Build.VERSION_CODES.Q.toLong()
25 | ) version: Int
26 | ): Boolean = SDK_INT >= version
27 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/fragment_typography_demo.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
21 |
22 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/fragment_bottom_navigation.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
21 |
22 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/fragment_home.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
22 |
23 |
--------------------------------------------------------------------------------
/.idea/jarRepositories.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/fragment_buttons.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
16 |
17 |
25 |
--------------------------------------------------------------------------------
/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 | # IDE (e.g. Android Studio) users:
3 | # Gradle settings configured through the IDE *will override*
4 | # any settings specified in this file.
5 | # For more details on how to configure your build environment visit
6 | # http://www.gradle.org/docs/current/userguide/build_environment.html
7 | # Specifies the JVM arguments used for the daemon process.
8 | # The setting is particularly useful for tweaking memory settings.
9 | org.gradle.jvmargs=-Xmx2048m
10 | # When configured, Gradle will run in incubating parallel mode.
11 | # This option should only be used with decoupled projects. More details, visit
12 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
13 | # org.gradle.parallel=true
14 | # AndroidX package structure to make it clearer which packages are bundled with the
15 | # Android operating system, and which are packaged with your app"s APK
16 | # https://developer.android.com/topic/libraries/support-library/androidx-rn
17 | android.useAndroidX=true
18 | # Automatically convert third-party libraries to use AndroidX
19 | android.enableJetifier=true
20 | # Kotlin code style for this project: "official" or "obsolete":
21 | kotlin.code.style=official
--------------------------------------------------------------------------------
/app/src/main/java/com/github/odaridavid/materialx/commons/ContextExtensions.kt:
--------------------------------------------------------------------------------
1 | /**
2 | *
3 | * Copyright 2020 David Odari
4 | *
5 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
6 | * in compliance with the License. You may obtain a copy of the License at
7 | * http://www.apache.org/licenses/LICENSE-2.0
8 | * Unless required by applicable law or agreed to in writing, software distributed under the License
9 | * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
10 | * or implied. See the License for the specific language governing permissions and limitations under
11 | * the License.
12 | *
13 | **/
14 | package com.github.odaridavid.materialx.commons
15 |
16 | import android.content.Context
17 | import android.graphics.drawable.Drawable
18 | import android.widget.Toast
19 | import androidx.annotation.DrawableRes
20 | import androidx.core.content.res.ResourcesCompat
21 |
22 |
23 | internal fun Context.getImageDrawable(@DrawableRes id: Int): Drawable {
24 | return ResourcesCompat.getDrawable(resources, id, null)!!
25 | }
26 |
27 | internal fun Context.showToast(message:String){
28 | Toast.makeText(this,message,Toast.LENGTH_SHORT).show()
29 | }
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_settings_24.xml:
--------------------------------------------------------------------------------
1 |
7 |
10 |
11 |
--------------------------------------------------------------------------------
/app/src/main/java/com/github/odaridavid/materialx/animations/AnimationsFragment.kt:
--------------------------------------------------------------------------------
1 | package com.github.odaridavid.materialx.animations
2 |
3 | import android.os.Bundle
4 | import android.view.View
5 | import androidx.fragment.app.Fragment
6 | import com.github.odaridavid.materialx.R
7 | import com.github.odaridavid.materialx.commons.navigateOnClick
8 |
9 | internal class AnimationsFragment : Fragment(R.layout.fragment_animations) {
10 |
11 | override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
12 | super.onViewCreated(view, savedInstanceState)
13 | navigateOnClick(
14 | R.id.object_animator_button,
15 | R.id.action_animationsFragment_to_objectAnimatorFragment
16 | )
17 |
18 | navigateOnClick(
19 | R.id.value_animator_button,
20 | R.id.action_animationsFragment_to_valueAnimationsFragment
21 | )
22 |
23 | navigateOnClick(
24 | R.id.animator_set_button,
25 | R.id.action_animationsFragment_to_animatorSetFragment
26 | )
27 |
28 | navigateOnClick(
29 | R.id.animator_set_button,
30 | R.id.action_animationsFragment_to_layoutTransitionFragment
31 | )
32 |
33 | navigateOnClick(
34 | R.id.lottie_animation_button,
35 | R.id.action_animationsFragment_to_lottieFragment
36 | )
37 |
38 | }
39 |
40 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/github/odaridavid/materialx/commons/FragmentExtensions.kt:
--------------------------------------------------------------------------------
1 | /**
2 | *
3 | * Copyright 2020 David Odari
4 | *
5 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
6 | * in compliance with the License. You may obtain a copy of the License at
7 | * http://www.apache.org/licenses/LICENSE-2.0
8 | * Unless required by applicable law or agreed to in writing, software distributed under the License
9 | * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
10 | * or implied. See the License for the specific language governing permissions and limitations under
11 | * the License.
12 | *
13 | **/
14 | package com.github.odaridavid.materialx.commons
15 |
16 | import androidx.annotation.ColorRes
17 | import androidx.annotation.IdRes
18 | import androidx.core.content.ContextCompat
19 | import androidx.fragment.app.Fragment
20 | import androidx.navigation.fragment.findNavController
21 | import com.google.android.material.button.MaterialButton
22 |
23 |
24 | internal fun Fragment.getColor(@ColorRes id: Int): Int {
25 | return ContextCompat.getColor(requireContext(), id)
26 | }
27 |
28 | internal fun Fragment.navigateOnClick(@IdRes viewId: Int, @IdRes navAction: Int) {
29 | view?.findViewById(viewId)?.setOnClickListener {
30 | findNavController().navigate(navAction)
31 | }
32 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/github/odaridavid/materialx/grids/GridItem.kt:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | * Copyright 2020 David Odari
4 | *
5 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
6 | * in compliance with the License. You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software distributed under the License
11 | * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
12 | * or implied. See the License for the specific language governing permissions and limitations under
13 | * the License.
14 | *
15 | */
16 | package com.github.odaridavid.materialx.grids
17 |
18 | import androidx.annotation.DrawableRes
19 | import androidx.annotation.StringRes
20 | import com.github.odaridavid.materialx.R
21 |
22 |
23 | internal data class GridItem(@DrawableRes val image: Int, @StringRes val title: Int)
24 |
25 | internal fun getGridItems(): List {
26 | return listOf(
27 | GridItem(R.drawable.city, R.string.dummy_text_3),
28 | GridItem(R.drawable.mountain, R.string.dummy_text_3),
29 | GridItem(R.drawable.fox, R.string.dummy_text_3),
30 | GridItem(R.drawable.turtle, R.string.dummy_text_3),
31 | GridItem(R.drawable.timber, R.string.dummy_text_3),
32 | GridItem(R.drawable.hay, R.string.dummy_text_3)
33 | )
34 | }
35 |
--------------------------------------------------------------------------------
/app/src/main/java/com/github/odaridavid/materialx/commons/AlertDialogExtensions.kt:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | * Copyright 2020 David Odari
4 | *
5 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
6 | * in compliance with the License. You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software distributed under the License
11 | * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
12 | * or implied. See the License for the specific language governing permissions and limitations under
13 | * the License.
14 | *
15 | */
16 | package com.github.odaridavid.materialx.commons
17 |
18 | import android.content.DialogInterface
19 | import androidx.annotation.ColorRes
20 | import androidx.appcompat.app.AlertDialog
21 | import androidx.core.content.ContextCompat
22 | import com.github.odaridavid.materialx.R
23 |
24 |
25 | internal fun AlertDialog.getColor(@ColorRes id: Int): Int {
26 | return ContextCompat.getColor(context, id)
27 | }
28 |
29 | internal fun AlertDialog.initButtonsStyle() {
30 | getButton(DialogInterface.BUTTON_POSITIVE).setTextColor(getColor(R.color.color_pink_900))
31 | getButton(DialogInterface.BUTTON_NEGATIVE).setTextColor(getColor(R.color.color_pink_900))
32 | getButton(DialogInterface.BUTTON_NEUTRAL).setTextColor(getColor(R.color.color_grey_800))
33 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/github/odaridavid/materialx/animations/ObjectAnimatorFragment.kt:
--------------------------------------------------------------------------------
1 | package com.github.odaridavid.materialx.animations
2 |
3 | import android.animation.ObjectAnimator
4 | import android.os.Bundle
5 | import android.view.View
6 | import android.view.animation.AnticipateOvershootInterpolator
7 | import android.widget.Button
8 | import android.widget.TextView
9 | import androidx.fragment.app.Fragment
10 | import com.github.odaridavid.materialx.R
11 |
12 |
13 | //TODO Dynamically choose interpolator
14 | class ObjectAnimatorFragment : Fragment(R.layout.fragment_object_animator) {
15 |
16 | override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
17 | super.onViewCreated(view, savedInstanceState)
18 | val animatedTextView = view.findViewById(R.id.animated_text_view)
19 | val startButton = view.findViewById(R.id.start_animation_button)
20 |
21 | val oaScaleX = ObjectAnimator.ofFloat(animatedTextView, View.SCALE_X, 0.7f, 1.0f).apply {
22 | duration = 4000
23 | interpolator = AnticipateOvershootInterpolator()
24 | }
25 |
26 | val oaScaleY = ObjectAnimator.ofFloat(animatedTextView, View.SCALE_Y, 0.7f, 1.0f).apply {
27 | duration = 4000
28 | interpolator = AnticipateOvershootInterpolator()
29 | }
30 |
31 | startButton.setOnClickListener {
32 | oaScaleX.start()
33 | oaScaleY.start()
34 | }
35 | }
36 | }
--------------------------------------------------------------------------------
/app/src/main/res/layout/fragment_motion_layout.xml:
--------------------------------------------------------------------------------
1 |
2 |
10 |
11 |
18 |
19 |
26 |
27 |
33 |
34 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/fragment_object_animator.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
19 |
20 |
30 |
31 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/fragment_value_animations.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
19 |
20 |
30 |
31 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/item_grid.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
18 |
19 |
30 |
31 |
--------------------------------------------------------------------------------
/app/src/main/java/com/github/odaridavid/materialx/animations/AnimatorListener.kt:
--------------------------------------------------------------------------------
1 | /**
2 | *
3 | * Copyright 2020 David Odari
4 | *
5 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
6 | * in compliance with the License. You may obtain a copy of the License at
7 | * http://www.apache.org/licenses/LICENSE-2.0
8 | * Unless required by applicable law or agreed to in writing, software distributed under the License
9 | * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
10 | * or implied. See the License for the specific language governing permissions and limitations under
11 | * the License.
12 | *
13 | **/
14 | package com.github.odaridavid.materialx.animations
15 |
16 | import android.animation.Animator
17 | import android.animation.AnimatorListenerAdapter
18 |
19 | /**
20 | * Use AnimatorListenerAdapter over AnimatorListener if you dont want to override
21 | * all listener methods.
22 | */
23 | internal class AnimatorListener(
24 | private inline val onStart: (() -> Unit)? = null,
25 | private inline val onEnd: (() -> Unit)? = null
26 | ) : AnimatorListenerAdapter() {
27 |
28 | override fun onAnimationStart(animation: Animator?) {
29 | super.onAnimationStart(animation)
30 | onStart?.invoke()
31 | }
32 |
33 | override fun onAnimationEnd(animation: Animator?, isReverse: Boolean) {
34 | super.onAnimationEnd(animation, isReverse)
35 | onEnd?.invoke()
36 | }
37 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/github/odaridavid/materialx/buttons/ButtonsFragment.kt:
--------------------------------------------------------------------------------
1 | /**
2 | *
3 | * Copyright 2020 David Odari
4 | *
5 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
6 | * in compliance with the License. You may obtain a copy of the License at
7 | * http://www.apache.org/licenses/LICENSE-2.0
8 | * Unless required by applicable law or agreed to in writing, software distributed under the License
9 | * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
10 | * or implied. See the License for the specific language governing permissions and limitations under
11 | * the License.
12 | *
13 | **/
14 | package com.github.odaridavid.materialx.buttons
15 |
16 | import android.os.Bundle
17 | import android.view.View
18 | import androidx.fragment.app.Fragment
19 | import com.github.odaridavid.materialx.R
20 | import com.github.odaridavid.materialx.commons.navigateOnClick
21 |
22 |
23 | internal class ButtonsFragment : Fragment(R.layout.fragment_buttons) {
24 |
25 | override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
26 | super.onViewCreated(view, savedInstanceState)
27 | navigateOnClick(
28 | R.id.material_button,
29 | R.id.action_buttonsFragment_to_materialButtonsFragment
30 | )
31 | navigateOnClick(
32 | R.id.floating_action_button,
33 | R.id.action_buttonsFragment_to_floatingActionButtonFragment
34 | )
35 | }
36 | }
--------------------------------------------------------------------------------
/app/src/main/res/layout/item_grid_linear.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
19 |
20 |
31 |
32 |
--------------------------------------------------------------------------------
/app/src/main/java/com/github/odaridavid/materialx/typography/TypographyDemoFragment.kt:
--------------------------------------------------------------------------------
1 | /**
2 | *
3 | * Copyright 2020 David Odari
4 | *
5 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
6 | * in compliance with the License. You may obtain a copy of the License at
7 | * http://www.apache.org/licenses/LICENSE-2.0
8 | * Unless required by applicable law or agreed to in writing, software distributed under the License
9 | * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
10 | * or implied. See the License for the specific language governing permissions and limitations under
11 | * the License.
12 | *
13 | **/
14 | package com.github.odaridavid.materialx.typography
15 |
16 | import android.os.Bundle
17 | import android.view.View
18 | import androidx.fragment.app.Fragment
19 | import androidx.recyclerview.widget.RecyclerView
20 | import com.github.odaridavid.materialx.R
21 |
22 |
23 | internal class TypographyDemoFragment : Fragment(R.layout.fragment_typography_demo) {
24 | override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
25 | super.onViewCreated(view, savedInstanceState)
26 | view.findViewById(R.id.typography_demo_recycler_view).apply {
27 | val demos = TypographyDataGenerator.generateTypographyDemos(context)
28 | val adapter = TypographyDemoAdapter()
29 | adapter.submitList(demos)
30 | this.adapter = adapter
31 | }
32 | }
33 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/github/odaridavid/materialx/typography/TypographyFragment.kt:
--------------------------------------------------------------------------------
1 | /**
2 | *
3 | * Copyright 2020 David Odari
4 | *
5 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
6 | * in compliance with the License. You may obtain a copy of the License at
7 | * http://www.apache.org/licenses/LICENSE-2.0
8 | * Unless required by applicable law or agreed to in writing, software distributed under the License
9 | * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
10 | * or implied. See the License for the specific language governing permissions and limitations under
11 | * the License.
12 | *
13 | **/
14 | package com.github.odaridavid.materialx.typography
15 |
16 | import android.os.Bundle
17 | import android.view.View
18 | import androidx.fragment.app.Fragment
19 | import com.github.odaridavid.materialx.R
20 | import com.github.odaridavid.materialx.commons.navigateOnClick
21 |
22 | //TODO Animate while transitioning to new fragment
23 | internal class TypographyFragment : Fragment(R.layout.fragment_typography) {
24 |
25 | override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
26 | super.onViewCreated(view, savedInstanceState)
27 | navigateOnClick(
28 | R.id.typography_reference_button,
29 | R.id.action_typographyFragment_to_typographyReferenceFragment
30 | )
31 | navigateOnClick(
32 | R.id.typography_demo_button,
33 | R.id.action_typographyFragment_to_typographyDemoFragment
34 | )
35 | }
36 |
37 | }
--------------------------------------------------------------------------------
/app/src/main/res/layout/fragment_typography.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
18 |
19 |
31 |
32 |
--------------------------------------------------------------------------------
/app/src/main/java/com/github/odaridavid/materialx/HomeFragment.kt:
--------------------------------------------------------------------------------
1 | /**
2 | *
3 | * Copyright 2020 David Odari
4 | *
5 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
6 | * in compliance with the License. You may obtain a copy of the License at
7 | * http://www.apache.org/licenses/LICENSE-2.0
8 | * Unless required by applicable law or agreed to in writing, software distributed under the License
9 | * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
10 | * or implied. See the License for the specific language governing permissions and limitations under
11 | * the License.
12 | *
13 | **/
14 | package com.github.odaridavid.materialx
15 |
16 | import android.os.Bundle
17 | import android.view.View
18 | import androidx.annotation.IdRes
19 | import androidx.fragment.app.Fragment
20 | import androidx.navigation.fragment.findNavController
21 | import androidx.recyclerview.widget.RecyclerView
22 |
23 |
24 | internal class HomeFragment : Fragment(R.layout.fragment_home) {
25 |
26 | override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
27 | super.onViewCreated(view, savedInstanceState)
28 | val categoryRecyclerView =
29 | view.findViewById(R.id.home_categories_recycler_view)
30 | categoryRecyclerView.adapter =
31 | HomeCategoryAdapter { navAction -> navigate(navAction) }.apply {
32 | submitList(getHomeCategories())
33 | }
34 | }
35 |
36 | private fun navigate(@IdRes id: Int) = findNavController().navigate(id)
37 |
38 | }
--------------------------------------------------------------------------------
/app/src/main/res/layout/item_grid_staggered.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
20 |
21 |
32 |
33 |
34 |
--------------------------------------------------------------------------------
/app/src/main/java/com/github/odaridavid/materialx/input/InputFragment.kt:
--------------------------------------------------------------------------------
1 | /**
2 | *
3 | * Copyright 2020 David Odari
4 | *
5 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
6 | * in compliance with the License. You may obtain a copy of the License at
7 | * http://www.apache.org/licenses/LICENSE-2.0
8 | * Unless required by applicable law or agreed to in writing, software distributed under the License
9 | * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
10 | * or implied. See the License for the specific language governing permissions and limitations under
11 | * the License.
12 | *
13 | **/
14 | package com.github.odaridavid.materialx.input
15 |
16 | import android.os.Bundle
17 | import android.view.View
18 | import android.widget.ArrayAdapter
19 | import androidx.fragment.app.Fragment
20 | import com.github.odaridavid.materialx.R
21 | import com.google.android.material.textfield.MaterialAutoCompleteTextView
22 | import com.google.android.material.textfield.TextInputLayout
23 |
24 |
25 | internal class InputFragment : Fragment(R.layout.fragment_input) {
26 |
27 | override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
28 | super.onViewCreated(view, savedInstanceState)
29 | val layout = view.findViewById(R.id.dropdown_input)
30 | val items = listOf("Material", "Design", "Components", "Android")
31 | val adapter = ArrayAdapter(requireContext(), R.layout.item_input_dropdown, items)
32 | (layout.editText as? MaterialAutoCompleteTextView)?.setAdapter(adapter)
33 | }
34 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/github/odaridavid/materialx/animations/ValueAnimatorFragment.kt:
--------------------------------------------------------------------------------
1 | package com.github.odaridavid.materialx.animations
2 |
3 | import android.animation.ValueAnimator
4 | import android.os.Bundle
5 | import android.view.View
6 | import android.widget.Button
7 | import android.widget.TextView
8 | import androidx.fragment.app.Fragment
9 | import com.github.odaridavid.materialx.R
10 | import com.github.odaridavid.materialx.commons.getColor
11 |
12 |
13 | class ValueAnimatorFragment : Fragment(R.layout.fragment_value_animations) {
14 |
15 | override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
16 | super.onViewCreated(view, savedInstanceState)
17 | val animatedTextView = view.findViewById(R.id.animated_text_view)
18 | val startButton = view.findViewById(R.id.start_animation_button)
19 | val vaPosY = ValueAnimator.ofFloat(0.0f, 200.0f).apply {
20 | duration = 5000
21 | addUpdateListener { valueAnimator ->
22 | animatedTextView.translationY = valueAnimator.animatedValue as Float
23 | }
24 | }
25 | val vaColor =
26 | ValueAnimator.ofArgb(
27 | getColor(R.color.color_grey_50),
28 | getColor(R.color.color_pink_900_dark)
29 | ).apply {
30 | duration = 5000
31 | addUpdateListener { valueAnimator ->
32 | animatedTextView.setTextColor(valueAnimator.animatedValue as Int)
33 | }
34 | }
35 |
36 | startButton.setOnClickListener {
37 | vaPosY.start()
38 | vaColor.start()
39 | }
40 |
41 | }
42 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/github/odaridavid/materialx/customview/MaterialXImageView.kt:
--------------------------------------------------------------------------------
1 | /**
2 | *
3 | * Copyright 2020 David Odari
4 | *
5 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
6 | * in compliance with the License. You may obtain a copy of the License at
7 | * http://www.apache.org/licenses/LICENSE-2.0
8 | * Unless required by applicable law or agreed to in writing, software distributed under the License
9 | * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
10 | * or implied. See the License for the specific language governing permissions and limitations under
11 | * the License.
12 | *
13 | **/
14 | package com.github.odaridavid.materialx.customview
15 |
16 | import android.content.Context
17 | import android.util.AttributeSet
18 | import androidx.appcompat.widget.AppCompatImageView
19 |
20 |
21 | internal class MaterialXImageView @JvmOverloads constructor(
22 | context: Context,
23 | attrs: AttributeSet? = null,
24 | defStyleAttr: Int = 0
25 | ) : AppCompatImageView(context, attrs, defStyleAttr) {
26 |
27 | private var aspectRatio: Double = INVALID_ASPECT_RATIO
28 |
29 | override fun onMeasure(widthMeasureSpec: Int, heightMeasureSpec: Int) {
30 | super.onMeasure(widthMeasureSpec, heightMeasureSpec)
31 |
32 | if (aspectRatio == INVALID_ASPECT_RATIO) return
33 |
34 | val width = measuredWidth
35 | val height = (width * aspectRatio).toInt()
36 | if (height == measuredHeight) return
37 | setMeasuredDimension(width, height)
38 | }
39 |
40 | companion object {
41 | const val INVALID_ASPECT_RATIO = -1.0
42 | }
43 | }
44 |
45 |
46 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/item_home_category.xml:
--------------------------------------------------------------------------------
1 |
2 |
13 |
14 |
19 |
20 |
28 |
29 |
37 |
38 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable-v24/ic_launcher_foreground.xml:
--------------------------------------------------------------------------------
1 |
7 |
8 |
9 |
15 |
18 |
21 |
22 |
23 |
24 |
30 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/fragment_animator_set.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
19 |
20 |
29 |
30 |
40 |
--------------------------------------------------------------------------------
/app/src/main/java/com/github/odaridavid/materialx/buttons/MaterialButtonsFragment.kt:
--------------------------------------------------------------------------------
1 | /**
2 | *
3 | * Copyright 2020 David Odari
4 | *
5 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
6 | * in compliance with the License. You may obtain a copy of the License at
7 | * http://www.apache.org/licenses/LICENSE-2.0
8 | * Unless required by applicable law or agreed to in writing, software distributed under the License
9 | * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
10 | * or implied. See the License for the specific language governing permissions and limitations under
11 | * the License.
12 | *
13 | **/
14 | package com.github.odaridavid.materialx.buttons
15 |
16 | import android.os.Bundle
17 | import android.view.View
18 | import androidx.fragment.app.Fragment
19 | import com.github.odaridavid.materialx.R
20 | import com.google.android.material.button.MaterialButtonToggleGroup
21 |
22 |
23 | internal class MaterialButtonsFragment : Fragment(R.layout.fragment_material_buttons) {
24 |
25 | private lateinit var materialButtonToggleGroup: MaterialButtonToggleGroup
26 | private val materialButtonToggleGroupListener =
27 | MaterialButtonToggleGroup.OnButtonCheckedListener { group, checkedId, isChecked ->
28 | //Logic here
29 | }
30 |
31 | override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
32 | super.onViewCreated(view, savedInstanceState)
33 | materialButtonToggleGroup =
34 | view.findViewById(R.id.material_toggle_group).apply {
35 | addOnButtonCheckedListener(materialButtonToggleGroupListener)
36 | }
37 | }
38 |
39 | override fun onDestroy() {
40 | super.onDestroy()
41 | materialButtonToggleGroup.removeOnButtonCheckedListener(materialButtonToggleGroupListener)
42 | }
43 | }
--------------------------------------------------------------------------------
/app/src/main/res/values/themes.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
22 |
23 |
24 |
25 |
35 |
36 |
--------------------------------------------------------------------------------
/app/src/main/java/com/github/odaridavid/materialx/buttons/FloatingActionButtonFragment.kt:
--------------------------------------------------------------------------------
1 | /**
2 | *
3 | * Copyright 2020 David Odari
4 | *
5 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
6 | * in compliance with the License. You may obtain a copy of the License at
7 | * http://www.apache.org/licenses/LICENSE-2.0
8 | * Unless required by applicable law or agreed to in writing, software distributed under the License
9 | * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
10 | * or implied. See the License for the specific language governing permissions and limitations under
11 | * the License.
12 | *
13 | **/
14 | package com.github.odaridavid.materialx.buttons
15 |
16 | import android.os.Bundle
17 | import android.view.View
18 | import androidx.fragment.app.Fragment
19 | import com.github.odaridavid.materialx.R
20 | import com.google.android.material.button.MaterialButton
21 | import com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton
22 | import com.google.android.material.floatingactionbutton.FloatingActionButton
23 |
24 |
25 | internal class FloatingActionButtonFragment : Fragment(R.layout.fragment_floating_action_button) {
26 |
27 | override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
28 | super.onViewCreated(view, savedInstanceState)
29 | val showFab: MaterialButton = view.findViewById(R.id.show_fab_button)
30 | val fab: FloatingActionButton = view.findViewById(R.id.fab_favs)
31 | val fabExtended: ExtendedFloatingActionButton = view.findViewById(R.id.fab_favs_extended)
32 | fab.setOnClickListener {
33 | fab.hide()
34 | showFab.visibility = View.VISIBLE
35 | }
36 | showFab.setOnClickListener {
37 | fab.show()
38 | showFab.visibility = View.INVISIBLE
39 | }
40 |
41 | fabExtended.setOnClickListener {
42 | if (fabExtended.isExtended) fabExtended.shrink() else fabExtended.extend()
43 | }
44 |
45 | }
46 | }
--------------------------------------------------------------------------------
/app/src/main/res/layout/view_material_dialog.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
19 |
20 |
32 |
33 |
45 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/fragment_grids.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
18 |
19 |
26 |
27 |
37 |
38 |
39 |
48 |
49 |
--------------------------------------------------------------------------------
/app/src/main/java/com/github/odaridavid/materialx/typography/TypographyDataGenerator.kt:
--------------------------------------------------------------------------------
1 | /**
2 | *
3 | * Copyright 2020 David Odari
4 | *
5 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
6 | * in compliance with the License. You may obtain a copy of the License at
7 | * http://www.apache.org/licenses/LICENSE-2.0
8 | * Unless required by applicable law or agreed to in writing, software distributed under the License
9 | * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
10 | * or implied. See the License for the specific language governing permissions and limitations under
11 | * the License.
12 | *
13 | **/
14 | package com.github.odaridavid.materialx.typography
15 |
16 | import android.content.Context
17 | import com.github.odaridavid.materialx.R
18 | import com.github.odaridavid.materialx.commons.getImageDrawable
19 |
20 |
21 | internal object TypographyDataGenerator {
22 | fun generateTypographyDemos(context: Context): List {
23 | val headline = "Headliners Story"
24 | val subtitle = "David Odari"
25 | val body =
26 | "This is a story about a yada yada doing yada yada and he couldn't yada yada so he decided to yada yada"
27 | val caption = "27th March 2020"
28 | return listOf(
29 | TypographyDemo(
30 | context.getImageDrawable(R.drawable.city),
31 | "City View",
32 | headline,
33 | subtitle,
34 | body,
35 | caption
36 | ),
37 | TypographyDemo(
38 | context.getImageDrawable(R.drawable.fox),
39 | "Fox posing for a picture",
40 | headline,
41 | subtitle,
42 | body,
43 | caption
44 | ),
45 | TypographyDemo(
46 | context.getImageDrawable(R.drawable.mountain),
47 | "Mountain with snow at the peak",
48 | headline,
49 | subtitle,
50 | body,
51 | caption
52 | ),
53 | TypographyDemo(
54 | context.getImageDrawable(R.drawable.timber),
55 | "Timber on a path",
56 | headline,
57 | subtitle,
58 | body,
59 | caption
60 | )
61 | )
62 | }
63 | }
--------------------------------------------------------------------------------
/app/src/main/res/layout/fragment_material_dialogs.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
16 |
17 |
25 |
26 |
34 |
35 |
43 |
44 |
52 |
53 |
--------------------------------------------------------------------------------
/app/src/main/java/com/github/odaridavid/materialx/animations/LayoutTransitionFragment.kt:
--------------------------------------------------------------------------------
1 | package com.github.odaridavid.materialx.animations
2 |
3 | import android.animation.AnimatorSet
4 | import android.animation.LayoutTransition
5 | import android.animation.ObjectAnimator
6 | import android.os.Bundle
7 | import android.view.View
8 | import android.widget.TextView
9 | import androidx.constraintlayout.widget.ConstraintLayout
10 | import androidx.fragment.app.Fragment
11 | import com.github.odaridavid.materialx.R
12 | import com.google.android.material.button.MaterialButton
13 |
14 |
15 | class LayoutTransitionFragment : Fragment(R.layout.fragment_layout_transition) {
16 |
17 | override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
18 | super.onViewCreated(view, savedInstanceState)
19 |
20 | val constraintLayout = view.findViewById(R.id.layout)
21 | val dummyTitle = view.findViewById(R.id.dummy_title)
22 |
23 | // val layoutTransition = LayoutTransition().apply {
24 | // //TODO Appearing animation doesnt seem to be doing what its supposed to
25 | // val oaAlphaVisible =
26 | // ObjectAnimator.ofFloat(dummyTitle, View.ALPHA, dummyTitle.alpha, 1.0f)
27 | // val asAppearing = AnimatorSet().apply {
28 | // play(oaAlphaVisible)
29 | // duration = 6000
30 | // }
31 | //
32 | // val oaAlphaInvisible =
33 | // ObjectAnimator.ofFloat(dummyTitle, View.ALPHA, dummyTitle.alpha, 0.0f)
34 | // val asDisappearing = AnimatorSet().apply {
35 | // play(oaAlphaInvisible)
36 | // duration = 2000
37 | // }
38 | //
39 | // setAnimator(LayoutTransition.APPEARING, asAppearing)
40 | // setAnimator(LayoutTransition.DISAPPEARING, asDisappearing)
41 | // }
42 | //
43 | // constraintLayout.layoutTransition = layoutTransition
44 |
45 | val sb = view.findViewById(R.id.show_button)
46 | val hb = view.findViewById(R.id.hide_button)
47 | val rb = view.findViewById(R.id.remove_button)
48 |
49 | sb.setOnClickListener {
50 | dummyTitle.visibility = View.VISIBLE
51 | }
52 |
53 | hb.setOnClickListener {
54 | dummyTitle.visibility = View.INVISIBLE
55 | }
56 |
57 | rb.setOnClickListener {
58 | dummyTitle.visibility = View.GONE
59 | }
60 | }
61 |
62 | }
--------------------------------------------------------------------------------
/gradlew.bat:
--------------------------------------------------------------------------------
1 | @if "%DEBUG%" == "" @echo off
2 | @rem ##########################################################################
3 | @rem
4 | @rem Gradle startup script for Windows
5 | @rem
6 | @rem ##########################################################################
7 |
8 | @rem Set local scope for the variables with windows NT shell
9 | if "%OS%"=="Windows_NT" setlocal
10 |
11 | set DIRNAME=%~dp0
12 | if "%DIRNAME%" == "" set DIRNAME=.
13 | set APP_BASE_NAME=%~n0
14 | set APP_HOME=%DIRNAME%
15 |
16 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
17 | set DEFAULT_JVM_OPTS=
18 |
19 | @rem Find java.exe
20 | if defined JAVA_HOME goto findJavaFromJavaHome
21 |
22 | set JAVA_EXE=java.exe
23 | %JAVA_EXE% -version >NUL 2>&1
24 | if "%ERRORLEVEL%" == "0" goto init
25 |
26 | echo.
27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28 | echo.
29 | echo Please set the JAVA_HOME variable in your environment to match the
30 | echo location of your Java installation.
31 |
32 | goto fail
33 |
34 | :findJavaFromJavaHome
35 | set JAVA_HOME=%JAVA_HOME:"=%
36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37 |
38 | if exist "%JAVA_EXE%" goto init
39 |
40 | echo.
41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42 | echo.
43 | echo Please set the JAVA_HOME variable in your environment to match the
44 | echo location of your Java installation.
45 |
46 | goto fail
47 |
48 | :init
49 | @rem Get command-line arguments, handling Windows variants
50 |
51 | if not "%OS%" == "Windows_NT" goto win9xME_args
52 |
53 | :win9xME_args
54 | @rem Slurp the command line arguments.
55 | set CMD_LINE_ARGS=
56 | set _SKIP=2
57 |
58 | :win9xME_args_slurp
59 | if "x%~1" == "x" goto execute
60 |
61 | set CMD_LINE_ARGS=%*
62 |
63 | :execute
64 | @rem Setup the command line
65 |
66 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
67 |
68 | @rem Execute Gradle
69 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
70 |
71 | :end
72 | @rem End local scope for the variables with windows NT shell
73 | if "%ERRORLEVEL%"=="0" goto mainEnd
74 |
75 | :fail
76 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
77 | rem the _cmd.exe /c_ return code!
78 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
79 | exit /b 1
80 |
81 | :mainEnd
82 | if "%OS%"=="Windows_NT" endlocal
83 |
84 | :omega
85 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/fragment_animations.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
18 |
19 |
27 |
28 |
36 |
37 |
45 |
46 |
54 |
55 |
--------------------------------------------------------------------------------
/app/build.gradle:
--------------------------------------------------------------------------------
1 | /**
2 | *
3 | * Copyright 2020 David Odari
4 | *
5 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
6 | * in compliance with the License. You may obtain a copy of the License at
7 | * http://www.apache.org/licenses/LICENSE-2.0
8 | * Unless required by applicable law or agreed to in writing, software distributed under the License
9 | * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
10 | * or implied. See the License for the specific language governing permissions and limitations under
11 | * the License.
12 | *
13 | **/
14 | plugins {
15 | id("com.android.application")
16 | id("kotlin-android")
17 | id("kotlin-android-extensions")
18 | }
19 |
20 | android {
21 | compileSdkVersion 30
22 | buildToolsVersion "30.0.0"
23 |
24 | defaultConfig {
25 | applicationId "com.github.odaridavid.materialx"
26 | minSdkVersion 21
27 | targetSdkVersion 30
28 | versionCode 1
29 | versionName "1.0"
30 |
31 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
32 | }
33 |
34 | buildTypes {
35 | release {
36 | minifyEnabled false
37 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
38 | }
39 | }
40 | compileOptions {
41 | targetCompatibility = JavaVersion.VERSION_1_8
42 | sourceCompatibility = JavaVersion.VERSION_1_8
43 | }
44 |
45 | kotlinOptions.jvmTarget = '1.8'
46 | buildFeatures.viewBinding = true
47 |
48 | }
49 |
50 | dependencies {
51 | def materialVersion = "1.3.0-alpha01"
52 | def navVersion = "2.3.0-rc01"
53 | def paletteVersion = "1.0.0"
54 | def coreKtxVersion = "1.3.0"
55 | def appCompatVersion = "1.1.0"
56 | def constraintLayoutVersion = "2.0.0-beta8"
57 | def legacySupportVersion = "1.0.0"
58 | def lottieVersion = "3.4.1"
59 |
60 | implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
61 | implementation "androidx.core:core-ktx:$coreKtxVersion"
62 | implementation "androidx.appcompat:appcompat:$appCompatVersion"
63 | implementation "androidx.constraintlayout:constraintlayout:$constraintLayoutVersion"
64 | implementation "com.google.android.material:material:$materialVersion"
65 | implementation "androidx.legacy:legacy-support-v4:$legacySupportVersion"
66 | implementation "androidx.navigation:navigation-fragment-ktx:$navVersion"
67 | implementation "androidx.navigation:navigation-ui-ktx:$navVersion"
68 | implementation "androidx.palette:palette:$paletteVersion"
69 | implementation "com.airbnb.android:lottie:$lottieVersion"
70 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/github/odaridavid/materialx/HomeCategory.kt:
--------------------------------------------------------------------------------
1 | /**
2 | *
3 | * Copyright 2020 David Odari
4 | *
5 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
6 | * in compliance with the License. You may obtain a copy of the License at
7 | * http://www.apache.org/licenses/LICENSE-2.0
8 | * Unless required by applicable law or agreed to in writing, software distributed under the License
9 | * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
10 | * or implied. See the License for the specific language governing permissions and limitations under
11 | * the License.
12 | *
13 | **/
14 | package com.github.odaridavid.materialx
15 |
16 | import androidx.annotation.DrawableRes
17 | import androidx.annotation.IdRes
18 | import androidx.annotation.StringRes
19 |
20 |
21 | internal data class HomeCategory(
22 | @StringRes val name: Int,
23 | @DrawableRes val icon: Int,
24 | @IdRes val navAction: Int
25 | )
26 |
27 |
28 | internal fun getHomeCategories(): List {
29 | return listOf(
30 | HomeCategory(
31 | R.string.label_typography,
32 | R.drawable.ic_typography_24,
33 | R.id.action_homeFragment_to_typographyFragment
34 | ),
35 | HomeCategory(
36 | R.string.label_buttons,
37 | R.drawable.ic_view_24,
38 | R.id.action_homeFragment_to_buttonsFragment
39 | ),
40 | HomeCategory(
41 | R.string.label_color_palette,
42 | R.drawable.ic_color_palette_24,
43 | R.id.action_homeFragment_to_colorPaletteFragment
44 | ),
45 | HomeCategory(
46 | R.string.label_animations,
47 | R.drawable.ic_animation_24,
48 | R.id.action_homeFragment_to_animationsFragment
49 | ),
50 | HomeCategory(
51 | R.string.label_input,
52 | R.drawable.ic_input_24,
53 | R.id.action_homeFragment_to_inputFragment
54 | ),
55 | HomeCategory(
56 | R.string.label_bottom_navigation,
57 | R.drawable.ic_navigation_24,
58 | R.id.action_homeFragment_to_bottomNavFragment
59 | ),
60 | HomeCategory(
61 | R.string.label_grids,
62 | R.drawable.ic_grid_24,
63 | R.id.action_homeFragment_to_gridsFragment
64 | ),
65 | HomeCategory(
66 | R.string.label_motion,
67 | R.drawable.ic_motion_24,
68 | R.id.action_homeFragment_to_motionLayoutFragment
69 | ),
70 | HomeCategory(
71 | R.string.label_dialog,
72 | R.drawable.ic_dialog_24,
73 | R.id.action_homeFragment_to_materialDialogsFragment
74 | )
75 | )
76 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/github/odaridavid/materialx/bottomnav/BottomNavFragment.kt:
--------------------------------------------------------------------------------
1 | /**
2 | *
3 | * Copyright 2020 David Odari
4 | *
5 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
6 | * in compliance with the License. You may obtain a copy of the License at
7 | * http://www.apache.org/licenses/LICENSE-2.0
8 | * Unless required by applicable law or agreed to in writing, software distributed under the License
9 | * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
10 | * or implied. See the License for the specific language governing permissions and limitations under
11 | * the License.
12 | *
13 | **/
14 | package com.github.odaridavid.materialx.bottomnav
15 |
16 | import android.os.Bundle
17 | import android.view.MenuItem
18 | import android.view.View
19 | import androidx.annotation.IdRes
20 | import androidx.fragment.app.Fragment
21 | import com.github.odaridavid.materialx.R
22 | import com.github.odaridavid.materialx.commons.showToast
23 | import com.google.android.material.bottomnavigation.BottomNavigationView
24 |
25 |
26 | internal class BottomNavFragment : Fragment(R.layout.fragment_bottom_navigation),
27 | BottomNavigationView.OnNavigationItemSelectedListener {
28 |
29 | private var bottomNav: BottomNavigationView? = null
30 |
31 | override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
32 | super.onViewCreated(view, savedInstanceState)
33 | bottomNav = view.findViewById(R.id.bottom_navigation)
34 | bottomNav?.setOnNavigationItemSelectedListener(this)
35 | //Set a notification badge
36 | val badge = bottomNav?.getOrCreateBadge(Destination.NOTIFICATIONS.id)
37 | badge?.isVisible = true
38 | }
39 |
40 | override fun onNavigationItemSelected(item: MenuItem): Boolean {
41 | return when (val id = item.itemId) {
42 | Destination.HOME.id -> {
43 | context?.showToast("Home")
44 | true
45 | }
46 | Destination.SEARCH.id -> {
47 | context?.showToast("Search")
48 | true
49 | }
50 | Destination.SETTINGS.id -> {
51 | context?.showToast("Settings")
52 | true
53 | }
54 | Destination.NOTIFICATIONS.id -> {
55 | context?.showToast("Notifications")
56 | val badgeDrawable = bottomNav?.getBadge(id)
57 | badgeDrawable?.run {
58 | isVisible = false
59 | }
60 | true
61 | }
62 | else -> false
63 | }
64 | }
65 |
66 | }
67 |
68 | enum class Destination(@IdRes val id: Int) {
69 | HOME(R.id.action_home),
70 | SEARCH(R.id.action_search),
71 | SETTINGS(R.id.action_settings),
72 | NOTIFICATIONS(R.id.action_notifications)
73 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/github/odaridavid/materialx/HomeCategoryAdapter.kt:
--------------------------------------------------------------------------------
1 | /**
2 | *
3 | * Copyright 2020 David Odari
4 | *
5 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
6 | * in compliance with the License. You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software distributed under the License
11 | * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
12 | * or implied. See the License for the specific language governing permissions and limitations under
13 | * the License.
14 | *
15 | **/
16 | package com.github.odaridavid.materialx;
17 |
18 | import android.view.LayoutInflater
19 | import android.view.View
20 | import android.view.ViewGroup
21 | import android.widget.ImageView
22 | import android.widget.TextView
23 | import androidx.recyclerview.widget.DiffUtil
24 | import androidx.recyclerview.widget.ListAdapter
25 | import androidx.recyclerview.widget.RecyclerView
26 |
27 |
28 | internal class HomeCategoryAdapter(val onClick: (Int) -> Unit) :
29 | ListAdapter(DiffUtil) {
30 |
31 | override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): HomeCategoryViewHolder {
32 | val context = parent.context
33 | val view = LayoutInflater.from(context).inflate(R.layout.item_home_category, parent, false)
34 | return HomeCategoryViewHolder(view)
35 | }
36 |
37 | override fun onBindViewHolder(holder: HomeCategoryViewHolder, position: Int): Unit =
38 | getItem(position).let { holder.bind(it) }
39 |
40 | inner class HomeCategoryViewHolder(private val view: View) : RecyclerView.ViewHolder(view) {
41 |
42 | fun bind(category: HomeCategory) {
43 | with(view) {
44 | findViewById(R.id.home_category_icon_image_view).apply {
45 | val icon = context.getDrawable(category.icon)
46 | setImageDrawable(icon)
47 | }
48 | findViewById(R.id.home_category_label_text_view).apply {
49 | text = context.getString(category.name)
50 | }
51 | }
52 | view.setOnClickListener {
53 | onClick(category.navAction)
54 | }
55 | }
56 | }
57 |
58 | companion object {
59 | val DiffUtil = object : DiffUtil.ItemCallback() {
60 | override fun areItemsTheSame(oldItem: HomeCategory, newItem: HomeCategory): Boolean {
61 | return oldItem.name == newItem.name
62 | }
63 |
64 | override fun areContentsTheSame(oldItem: HomeCategory, newItem: HomeCategory): Boolean {
65 | return oldItem == newItem
66 | }
67 | }
68 | }
69 | }
--------------------------------------------------------------------------------
/app/src/main/res/layout/fragment_floating_action_button.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
10 |
21 |
22 |
33 |
34 |
44 |
45 |
57 |
58 |
59 |
--------------------------------------------------------------------------------
/app/src/main/java/com/github/odaridavid/materialx/colorpalette/ColorPaletteFragment.kt:
--------------------------------------------------------------------------------
1 | package com.github.odaridavid.materialx.colorpalette
2 |
3 | import android.graphics.BitmapFactory
4 | import android.os.Bundle
5 | import android.view.View
6 | import android.widget.ImageView
7 | import androidx.annotation.DrawableRes
8 | import androidx.fragment.app.Fragment
9 | import androidx.palette.graphics.Palette
10 | import com.github.odaridavid.materialx.R
11 | import com.github.odaridavid.materialx.commons.getColor
12 |
13 | //TODO Enable picking drawable to evaluate color
14 | internal class ColorPaletteFragment : Fragment(R.layout.fragment_color_palette) {
15 |
16 | private val defaultColor: Int
17 | get() = getColor(R.color.color_white)
18 |
19 | override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
20 | super.onViewCreated(view, savedInstanceState)
21 | val bitmap = getBitmap(randomDrawableRes())
22 | val palette = PaletteUtils.createPaletteSync(bitmap)
23 |
24 | view.findViewById(R.id.color_extraction_target_image_view).apply {
25 | setImageBitmap(bitmap)
26 | }
27 | setVibrantPalette(view, palette)
28 | setMutedPalette(view, palette)
29 | }
30 |
31 | private fun setMutedPalette(view: View, palette: Palette) {
32 | view.findViewById(R.id.muted_image_view).apply {
33 | val color = palette.getMutedColor(defaultColor)
34 | setBackgroundColor(color)
35 | }
36 | view.findViewById(R.id.light_muted_image_view).apply {
37 | val color = palette.getLightMutedColor(defaultColor)
38 | setBackgroundColor(color)
39 | }
40 | view.findViewById(R.id.dark_muted_image_view).apply {
41 | val color = palette.getDarkMutedColor(defaultColor)
42 | setBackgroundColor(color)
43 | }
44 | }
45 |
46 | private fun setVibrantPalette(view: View, palette: Palette) {
47 | view.findViewById(R.id.vibrant_image_view).apply {
48 | val color = palette.getVibrantColor(defaultColor)
49 | setBackgroundColor(color)
50 | }
51 | view.findViewById(R.id.light_vibrant_image_view).apply {
52 | val color = palette.getLightVibrantColor(defaultColor)
53 | setBackgroundColor(color)
54 | }
55 | view.findViewById(R.id.dark_vibrant_image_view).apply {
56 | val color = palette.getDarkVibrantColor(defaultColor)
57 | setBackgroundColor(color)
58 | }
59 | }
60 |
61 | private fun getBitmap(@DrawableRes id: Int) =
62 | BitmapFactory.decodeResource(requireContext().resources, id)
63 |
64 | @DrawableRes
65 | private fun randomDrawableRes(): Int {
66 | return when ((1..4).random()) {
67 | 1 -> R.drawable.city
68 | 2 -> R.drawable.timber
69 | 3 -> R.drawable.mountain
70 | else -> R.drawable.fox
71 | }
72 | }
73 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/github/odaridavid/materialx/grids/GridAdapter.kt:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | * Copyright 2020 David Odari
4 | *
5 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
6 | * in compliance with the License. You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software distributed under the License
11 | * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
12 | * or implied. See the License for the specific language governing permissions and limitations under
13 | * the License.
14 | *
15 | */
16 | package com.github.odaridavid.materialx.grids;
17 |
18 | import android.view.LayoutInflater
19 | import android.view.View
20 | import android.view.ViewGroup
21 | import android.widget.TextView
22 | import androidx.recyclerview.widget.DiffUtil
23 | import androidx.recyclerview.widget.ListAdapter
24 | import androidx.recyclerview.widget.RecyclerView
25 | import com.github.odaridavid.materialx.R
26 | import com.github.odaridavid.materialx.customview.MaterialXImageView
27 |
28 | internal class GridAdapter(val layout: Layout) :
29 | ListAdapter(DiffUtil) {
30 |
31 | override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): GridItemViewHolder {
32 | val context = parent.context
33 | val layoutId = when (layout) {
34 | Layout.GRID -> R.layout.item_grid
35 | Layout.STAGGERED_GRID -> R.layout.item_grid_staggered
36 | Layout.LINEAR -> R.layout.item_grid_linear
37 | }
38 | val view = LayoutInflater.from(context).inflate(layoutId, parent, false)
39 | return GridItemViewHolder(view)
40 | }
41 |
42 | override fun onBindViewHolder(holder: GridItemViewHolder, position: Int): Unit =
43 | getItem(position).let { holder.bind(it) }
44 |
45 | inner class GridItemViewHolder(private val view: View) : RecyclerView.ViewHolder(view) {
46 |
47 | fun bind(item: GridItem) {
48 | with(view) {
49 | findViewById(R.id.grid_item_picture_image_view).apply {
50 | val image = context.getDrawable(item.image)
51 | setImageDrawable(image)
52 | }
53 | findViewById(R.id.grid_item_title_text_view).apply {
54 | text = context.getString(item.title)
55 | }
56 | }
57 | }
58 | }
59 |
60 | companion object {
61 | val DiffUtil = object : DiffUtil.ItemCallback() {
62 | override fun areItemsTheSame(oldItem: GridItem, newItem: GridItem): Boolean {
63 | return oldItem.image == newItem.image && oldItem.title == newItem.title
64 | }
65 |
66 | override fun areContentsTheSame(oldItem: GridItem, newItem: GridItem): Boolean {
67 | return oldItem == newItem
68 | }
69 | }
70 | }
71 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/github/odaridavid/materialx/MainActivity.kt:
--------------------------------------------------------------------------------
1 | /**
2 | *
3 | * Copyright 2020 David Odari
4 | *
5 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
6 | * in compliance with the License. You may obtain a copy of the License at
7 | * http://www.apache.org/licenses/LICENSE-2.0
8 | * Unless required by applicable law or agreed to in writing, software distributed under the License
9 | * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
10 | * or implied. See the License for the specific language governing permissions and limitations under
11 | * the License.
12 | *
13 | **/
14 | package com.github.odaridavid.materialx
15 |
16 | import android.os.Build
17 | import android.os.Bundle
18 | import android.view.View
19 | import androidx.annotation.RequiresApi
20 | import androidx.appcompat.app.AppCompatActivity
21 | import androidx.core.content.ContextCompat
22 | import androidx.navigation.NavController
23 | import androidx.navigation.findNavController
24 | import androidx.navigation.ui.AppBarConfiguration
25 | import androidx.navigation.ui.navigateUp
26 | import androidx.navigation.ui.setupActionBarWithNavController
27 | import com.github.odaridavid.materialx.commons.versionFrom
28 |
29 |
30 | internal class MainActivity : AppCompatActivity(R.layout.activity_main) {
31 |
32 | private lateinit var appBarConfiguration: AppBarConfiguration
33 | private val navController: NavController by lazy {
34 | findNavController(R.id.nav_host_fragment)
35 | }
36 |
37 | override fun onCreate(savedInstanceState: Bundle?) {
38 | handleSystemBars()
39 | super.onCreate(savedInstanceState)
40 | appBarConfiguration = AppBarConfiguration(navController.graph)
41 | setupActionBarWithNavController(navController, appBarConfiguration)
42 | }
43 |
44 | private fun handleSystemBars() {
45 | if (versionFrom(Build.VERSION_CODES.M))
46 | setLightSystemBars()
47 | else
48 | setDefaultSystemBarColors()
49 | }
50 |
51 | private fun setDefaultSystemBarColors() {
52 | window.navigationBarColor = ContextCompat.getColor(this, R.color.color_grey_800_dark)
53 | window.statusBarColor = ContextCompat.getColor(this, R.color.color_grey_800_dark)
54 | }
55 |
56 | override fun onSupportNavigateUp(): Boolean {
57 | return navController.navigateUp(appBarConfiguration) || super.onSupportNavigateUp()
58 | }
59 |
60 | @RequiresApi(Build.VERSION_CODES.M)
61 | private fun setLightSystemBars() {
62 | window.decorView.systemUiVisibility = setUiVisibilityFlags()
63 | window.navigationBarColor = getColor(R.color.color_white)
64 | }
65 |
66 | @RequiresApi(Build.VERSION_CODES.M)
67 | private fun setUiVisibilityFlags(): Int =
68 | if (versionFrom(Build.VERSION_CODES.O))
69 | View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR or View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR
70 | else
71 | View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR
72 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/github/odaridavid/materialx/typography/TypographyDemoAdapter.kt:
--------------------------------------------------------------------------------
1 | /**
2 | *
3 | * Copyright 2020 David Odari
4 | *
5 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
6 | * in compliance with the License. You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software distributed under the License
11 | * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
12 | * or implied. See the License for the specific language governing permissions and limitations under
13 | * the License.
14 | *
15 | **/
16 | package com.github.odaridavid.materialx.typography;
17 |
18 | import android.view.LayoutInflater
19 | import android.view.View
20 | import android.view.ViewGroup
21 | import android.widget.ImageView
22 | import android.widget.TextView
23 | import androidx.recyclerview.widget.DiffUtil
24 | import androidx.recyclerview.widget.ListAdapter
25 | import androidx.recyclerview.widget.RecyclerView
26 | import com.github.odaridavid.materialx.R
27 |
28 |
29 | internal class TypographyDemoAdapter :
30 | ListAdapter(DiffUtil) {
31 |
32 | override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): TypographyDemoViewHolder {
33 | val context = parent.context
34 | val view =
35 | LayoutInflater.from(context).inflate(R.layout.item_typography_demo, parent, false)
36 | return TypographyDemoViewHolder(view)
37 | }
38 |
39 | override fun onBindViewHolder(holder: TypographyDemoViewHolder, position: Int): Unit =
40 | getItem(position).let { holder.bind(it) }
41 |
42 | inner class TypographyDemoViewHolder(private val view: View) : RecyclerView.ViewHolder(view) {
43 |
44 | fun bind(demo: TypographyDemo) {
45 | with(view) {
46 | findViewById(R.id.typography_demo_headline_text_view).text = demo.headline
47 | findViewById(R.id.typography_demo_overline_text_view).text = demo.overline
48 | findViewById(R.id.typography_demo_body_text_view).text = demo.body
49 | findViewById(R.id.typography_demo_caption_text_view).text = demo.caption
50 | findViewById(R.id.typograpy_demo_image_view).apply {
51 | contentDescription = demo.imageDescription
52 | setImageDrawable(demo.image)
53 | }
54 | }
55 | }
56 | }
57 |
58 | companion object {
59 | val DiffUtil = object : DiffUtil.ItemCallback() {
60 | override fun areItemsTheSame(
61 | oldItem: TypographyDemo,
62 | newItem: TypographyDemo
63 | ): Boolean = true
64 |
65 | override fun areContentsTheSame(
66 | oldItem: TypographyDemo,
67 | newItem: TypographyDemo
68 | ): Boolean = true
69 | }
70 | }
71 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/github/odaridavid/materialx/grids/GridsFragment.kt:
--------------------------------------------------------------------------------
1 | /**
2 | *
3 | * Copyright 2020 David Odari
4 | *
5 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
6 | * in compliance with the License. You may obtain a copy of the License at
7 | * http://www.apache.org/licenses/LICENSE-2.0
8 | * Unless required by applicable law or agreed to in writing, software distributed under the License
9 | * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
10 | * or implied. See the License for the specific language governing permissions and limitations under
11 | * the License.
12 | *
13 | **/
14 | package com.github.odaridavid.materialx.grids
15 |
16 | import android.os.Bundle
17 | import android.view.View
18 | import android.widget.ImageButton
19 | import androidx.fragment.app.Fragment
20 | import androidx.recyclerview.widget.GridLayoutManager
21 | import androidx.recyclerview.widget.LinearLayoutManager
22 | import androidx.recyclerview.widget.RecyclerView
23 | import androidx.recyclerview.widget.StaggeredGridLayoutManager
24 | import com.github.odaridavid.materialx.R
25 |
26 |
27 | internal class GridsFragment : Fragment(R.layout.fragment_grids) {
28 |
29 | private var currentLayout = Layout.LINEAR
30 |
31 | override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
32 | super.onViewCreated(view, savedInstanceState)
33 | val rvGrids = view.findViewById(R.id.grids_recycler_view)
34 | rvGrids.init(currentLayout)
35 | view.findViewById(R.id.selected_grid_image_button).apply {
36 | setOnClickListener {
37 | currentLayout = when (currentLayout) {
38 | Layout.LINEAR -> {
39 | setImageDrawable(requireContext().getDrawable(R.drawable.ic_grid_24))
40 | Layout.GRID
41 | }
42 | Layout.GRID -> {
43 | setImageDrawable(requireContext().getDrawable(R.drawable.ic_staggered_grid_24))
44 | Layout.STAGGERED_GRID
45 | }
46 | Layout.STAGGERED_GRID -> {
47 | setImageDrawable(requireContext().getDrawable(R.drawable.ic_default_grid))
48 | Layout.LINEAR
49 | }
50 | }
51 | rvGrids.init(currentLayout)
52 | }
53 | }
54 | }
55 |
56 | //TODO Dynamic span count
57 | private fun RecyclerView.init(layout: Layout) {
58 | val a = GridAdapter(layout).apply {
59 | submitList(getGridItems())
60 | }
61 | val lm: RecyclerView.LayoutManager = when (layout) {
62 | Layout.LINEAR -> LinearLayoutManager(requireContext())
63 | Layout.STAGGERED_GRID -> StaggeredGridLayoutManager(
64 | 2,
65 | StaggeredGridLayoutManager.VERTICAL
66 | )
67 | Layout.GRID -> GridLayoutManager(requireContext(), 2)
68 | }
69 | layoutManager = lm
70 | adapter = a
71 | }
72 |
73 | }
74 |
75 | enum class Layout {
76 | GRID,
77 | STAGGERED_GRID,
78 | LINEAR
79 | }
--------------------------------------------------------------------------------
/app/src/main/res/values/font_certs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | - @array/com_google_android_gms_fonts_certs_dev
5 | - @array/com_google_android_gms_fonts_certs_prod
6 |
7 |
8 | -
9 | MIIEqDCCA5CgAwIBAgIJANWFuGx90071MA0GCSqGSIb3DQEBBAUAMIGUMQswCQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMNTW91bnRhaW4gVmlldzEQMA4GA1UEChMHQW5kcm9pZDEQMA4GA1UECxMHQW5kcm9pZDEQMA4GA1UEAxMHQW5kcm9pZDEiMCAGCSqGSIb3DQEJARYTYW5kcm9pZEBhbmRyb2lkLmNvbTAeFw0wODA0MTUyMzM2NTZaFw0zNTA5MDEyMzM2NTZaMIGUMQswCQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMNTW91bnRhaW4gVmlldzEQMA4GA1UEChMHQW5kcm9pZDEQMA4GA1UECxMHQW5kcm9pZDEQMA4GA1UEAxMHQW5kcm9pZDEiMCAGCSqGSIb3DQEJARYTYW5kcm9pZEBhbmRyb2lkLmNvbTCCASAwDQYJKoZIhvcNAQEBBQADggENADCCAQgCggEBANbOLggKv+IxTdGNs8/TGFy0PTP6DHThvbbR24kT9ixcOd9W+EaBPWW+wPPKQmsHxajtWjmQwWfna8mZuSeJS48LIgAZlKkpFeVyxW0qMBujb8X8ETrWy550NaFtI6t9+u7hZeTfHwqNvacKhp1RbE6dBRGWynwMVX8XW8N1+UjFaq6GCJukT4qmpN2afb8sCjUigq0GuMwYXrFVee74bQgLHWGJwPmvmLHC69EH6kWr22ijx4OKXlSIx2xT1AsSHee70w5iDBiK4aph27yH3TxkXy9V89TDdexAcKk/cVHYNnDBapcavl7y0RiQ4biu8ymM8Ga/nmzhRKya6G0cGw8CAQOjgfwwgfkwHQYDVR0OBBYEFI0cxb6VTEM8YYY6FbBMvAPyT+CyMIHJBgNVHSMEgcEwgb6AFI0cxb6VTEM8YYY6FbBMvAPyT+CyoYGapIGXMIGUMQswCQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMNTW91bnRhaW4gVmlldzEQMA4GA1UEChMHQW5kcm9pZDEQMA4GA1UECxMHQW5kcm9pZDEQMA4GA1UEAxMHQW5kcm9pZDEiMCAGCSqGSIb3DQEJARYTYW5kcm9pZEBhbmRyb2lkLmNvbYIJANWFuGx90071MAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEEBQADggEBABnTDPEF+3iSP0wNfdIjIz1AlnrPzgAIHVvXxunW7SBrDhEglQZBbKJEk5kT0mtKoOD1JMrSu1xuTKEBahWRbqHsXclaXjoBADb0kkjVEJu/Lh5hgYZnOjvlba8Ld7HCKePCVePoTJBdI4fvugnL8TsgK05aIskyY0hKI9L8KfqfGTl1lzOv2KoWD0KWwtAWPoGChZxmQ+nBli+gwYMzM1vAkP+aayLe0a1EQimlOalO762r0GXO0ks+UeXde2Z4e+8S/pf7pITEI/tP+MxJTALw9QUWEv9lKTk+jkbqxbsh8nfBUapfKqYn0eidpwq2AzVp3juYl7//fKnaPhJD9gs=
10 |
11 |
12 |
13 | -
14 | MIIEQzCCAyugAwIBAgIJAMLgh0ZkSjCNMA0GCSqGSIb3DQEBBAUAMHQxCzAJBgNVBAYTAlVTMRMwEQYDVQQIEwpDYWxpZm9ybmlhMRYwFAYDVQQHEw1Nb3VudGFpbiBWaWV3MRQwEgYDVQQKEwtHb29nbGUgSW5jLjEQMA4GA1UECxMHQW5kcm9pZDEQMA4GA1UEAxMHQW5kcm9pZDAeFw0wODA4MjEyMzEzMzRaFw0zNjAxMDcyMzEzMzRaMHQxCzAJBgNVBAYTAlVTMRMwEQYDVQQIEwpDYWxpZm9ybmlhMRYwFAYDVQQHEw1Nb3VudGFpbiBWaWV3MRQwEgYDVQQKEwtHb29nbGUgSW5jLjEQMA4GA1UECxMHQW5kcm9pZDEQMA4GA1UEAxMHQW5kcm9pZDCCASAwDQYJKoZIhvcNAQEBBQADggENADCCAQgCggEBAKtWLgDYO6IIrgqWbxJOKdoR8qtW0I9Y4sypEwPpt1TTcvZApxsdyxMJZ2JORland2qSGT2y5b+3JKkedxiLDmpHpDsz2WCbdxgxRczfey5YZnTJ4VZbH0xqWVW/8lGmPav5xVwnIiJS6HXk+BVKZF+JcWjAsb/GEuq/eFdpuzSqeYTcfi6idkyugwfYwXFU1+5fZKUaRKYCwkkFQVfcAs1fXA5V+++FGfvjJ/CxURaSxaBvGdGDhfXE28LWuT9ozCl5xw4Yq5OGazvV24mZVSoOO0yZ31j7kYvtwYK6NeADwbSxDdJEqO4k//0zOHKrUiGYXtqw/A0LFFtqoZKFjnkCAQOjgdkwgdYwHQYDVR0OBBYEFMd9jMIhF1Ylmn/Tgt9r45jk14alMIGmBgNVHSMEgZ4wgZuAFMd9jMIhF1Ylmn/Tgt9r45jk14aloXikdjB0MQswCQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMNTW91bnRhaW4gVmlldzEUMBIGA1UEChMLR29vZ2xlIEluYy4xEDAOBgNVBAsTB0FuZHJvaWQxEDAOBgNVBAMTB0FuZHJvaWSCCQDC4IdGZEowjTAMBgNVHRMEBTADAQH/MA0GCSqGSIb3DQEBBAUAA4IBAQBt0lLO74UwLDYKqs6Tm8/yzKkEu116FmH4rkaymUIE0P9KaMftGlMexFlaYjzmB2OxZyl6euNXEsQH8gjwyxCUKRJNexBiGcCEyj6z+a1fuHHvkiaai+KL8W1EyNmgjmyy8AW7P+LLlkR+ho5zEHatRbM/YAnqGcFh5iZBqpknHf1SKMXFh4dd239FJ1jWYfbMDMy3NS5CTMQ2XFI1MvcyUTdZPErjQfTbQe3aDQsQcafEQPD+nqActifKZ0Np0IS9L9kR/wbNvyz6ENwPiTrjV2KRkEjH78ZMcUQXg0L3BYHJ3lc69Vs5Ddf9uUGGMYldX3WfMBEmh/9iFBDAaTCK
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/fragment_layout_transition.xml:
--------------------------------------------------------------------------------
1 |
2 |
11 |
12 |
22 |
23 |
34 |
35 |
46 |
47 |
57 |
58 |
68 |
69 |
79 |
80 |
--------------------------------------------------------------------------------
/app/src/main/java/com/github/odaridavid/materialx/animations/AnimatorSetFragment.kt:
--------------------------------------------------------------------------------
1 | package com.github.odaridavid.materialx.animations
2 |
3 | import android.animation.AnimatorSet
4 | import android.animation.ObjectAnimator
5 | import android.animation.PropertyValuesHolder
6 | import android.animation.ValueAnimator
7 | import android.os.Bundle
8 | import android.util.Log
9 | import android.view.View
10 | import android.widget.Button
11 | import android.widget.ImageView
12 | import androidx.fragment.app.Fragment
13 | import com.github.odaridavid.materialx.R
14 |
15 |
16 | class AnimatorSetFragment : Fragment(R.layout.fragment_animator_set) {
17 |
18 | //TODO Add Reverse animation option
19 | override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
20 | super.onViewCreated(view, savedInstanceState)
21 |
22 | val imageOne = view.findViewById(R.id.image_one_image_view)
23 | val imageTwo = view.findViewById(R.id.image_two_image_view)
24 | val startButton = view.findViewById(R.id.start_animation_button)
25 |
26 | val imageOneCoordinates = IntArray(2)
27 | val imageTwoCoordinates = IntArray(2)
28 |
29 | imageOne.getLocationOnScreen(imageOneCoordinates)
30 | imageTwo.getLocationOnScreen(imageTwoCoordinates)
31 |
32 | val imageOneInitialXPosition = imageOneCoordinates[0].toFloat()
33 | val imageTwoInitialXPosition = imageTwoCoordinates[0].toFloat()
34 | val imageOneInitialYPosition = imageOneCoordinates[1].toFloat()
35 | val imageTwoInitialYPosition = imageTwoCoordinates[1].toFloat()
36 |
37 |
38 | Log.i("AnimatorSet", "$imageOneInitialXPosition - $imageTwoInitialXPosition")
39 |
40 | val vaAlpha = ValueAnimator.ofFloat(0.0f, 1.0f).apply {
41 | duration = 3000
42 | addUpdateListener { valueAnimator ->
43 | val alphaValue = valueAnimator.animatedValue as Float
44 | imageOne.alpha = alphaValue
45 | imageTwo.alpha = alphaValue
46 | }
47 | }
48 |
49 | val imageOneTranslationY = PropertyValuesHolder.ofFloat(
50 | View.TRANSLATION_Y,
51 | -imageOneInitialYPosition,
52 | imageTwoInitialYPosition
53 | )
54 |
55 | val imageTwoTranslationY = PropertyValuesHolder.ofFloat(
56 | View.TRANSLATION_Y,
57 | imageTwoInitialYPosition,
58 | -imageOneInitialYPosition
59 | )
60 |
61 | //TODO Why is x always 0??
62 | val imageOneTranslationX = PropertyValuesHolder.ofFloat(
63 | View.TRANSLATION_X,
64 | imageOneInitialXPosition,
65 | -imageTwoInitialYPosition
66 | )
67 |
68 | val imageTwoTranslationX = PropertyValuesHolder.ofFloat(
69 | View.TRANSLATION_X,
70 | imageTwoInitialXPosition,
71 | imageTwoInitialYPosition
72 | )
73 |
74 | val oaImageOne =
75 | ObjectAnimator.ofPropertyValuesHolder(
76 | imageOne,
77 | imageOneTranslationY,
78 | imageOneTranslationX
79 | ).apply {
80 | duration = 2000
81 | }
82 |
83 | val oaImageTwo =
84 | ObjectAnimator.ofPropertyValuesHolder(
85 | imageTwo,
86 | imageTwoTranslationY,
87 | imageTwoTranslationX
88 | ).apply {
89 | duration = 2000
90 | }
91 |
92 | val animSet = AnimatorSet().apply {
93 | play(vaAlpha)
94 | .with(oaImageOne)
95 | .with(oaImageTwo)
96 | }
97 |
98 | startButton.setOnClickListener {
99 | animSet.start()
100 | }
101 |
102 | }
103 | }
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | ## Material-X
2 |
3 | My stash for all things material, animations, transitions, Animated VD, Color Palette API, UI design
4 | and more.
5 |
6 | ## Table of Contents
7 |
8 | - [Typography](#typography)
9 | - [Buttons](#buttons)
10 | - [Material Buttons](#material-buttons)
11 | - [Floating Action Buttons](#floating-action-buttons)
12 | - [Color Palette](#color-palette)
13 | - [Animations](#animations)
14 | - [Android APIs](#android-apis)
15 | - [Lottie](#lottie)
16 | - [Motion Layout](#motion-layout)
17 | - [Input](#input)
18 | - [Bottom Navigation](#bottom-navigation)
19 | - [Grids](#grids)
20 | - [Dialogs](#dialogs)
21 | - [Attributions](#attributions)
22 | - [References](#references)
23 | - [License](#license)
24 |
25 | ### Typography
26 |
27 |
28 |
29 | ### Buttons
30 |
31 | #### Material Buttons
32 |
33 |
34 |
35 | #### Floating Action Buttons
36 |
37 |
38 |
39 | ### Color Palette
40 |
41 |
42 |
43 | ### Animations
44 |
45 | #### Android APIs
46 |
47 |
48 |
49 | #### Lottie
50 |
51 |
52 |
53 | #### Motion Layout
54 |
55 |
56 |
57 | ### Input
58 |
59 |
60 |
61 | ### Bottom Navigation
62 |
63 |
64 |
65 | ### Grids
66 |
67 |
68 |
69 | ### Dialogs
70 |
71 |
72 |
73 | ### References
74 |
75 | - [Material Design Docs](https://material.io/develop/android)
76 | - [Material Color Tool](https://material.io/resources/color/#!/?view.left=0&view.right=0)
77 | - [Animations](https://developer.android.com/training/animation)
78 |
79 | ### Libraries
80 |
81 | - [Jetpack](https://developer.android.com/jetpack)
82 | - [Material Design](https://material.io/develop/android/docs/getting-started/)
83 | - [Lottie](https://github.com/airbnb/lottie-android)
84 |
85 | ### Attributions
86 |
87 | Images by :
88 |
89 | - RitaE ,
90 | - WagnerAnne
91 | - Alexas_Fotos
92 | - Полина Андреева
93 | - Syaibatul Hamdi
94 | - Matthias Böckel
95 |
96 | from Pixabay
97 |
98 | ### License
99 |
100 | ```
101 |
102 | Copyright 2020 David Odari.
103 |
104 | Licensed under the Apache License, Version 2.0 (the "License");
105 | you may not use this file except in compliance with the License.
106 | You may obtain a copy of the License at
107 |
108 | http://www.apache.org/licenses/LICENSE-2.0
109 |
110 | Unless required by applicable law or agreed to in writing, software
111 | distributed under the License is distributed on an "AS IS" BASIS,
112 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
113 | See the License for the specific language governing permissions and
114 | limitations under the License.
115 |
116 | ```
117 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/item_typography_demo.xml:
--------------------------------------------------------------------------------
1 |
2 |
15 |
16 |
19 |
20 |
31 |
32 |
43 |
44 |
45 |
56 |
57 |
69 |
70 |
82 |
83 |
84 |
85 |
86 |
--------------------------------------------------------------------------------
/app/src/main/res/xml/motion_scene.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
10 |
13 |
14 |
15 |
16 |
28 |
40 |
52 |
53 |
54 |
55 |
67 |
79 |
91 |
92 |
93 |
--------------------------------------------------------------------------------
/.idea/codeStyles/Project.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 | xmlns:android
34 |
35 | ^$
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 | xmlns:.*
45 |
46 | ^$
47 |
48 |
49 | BY_NAME
50 |
51 |
52 |
53 |
54 |
55 |
56 | .*:id
57 |
58 | http://schemas.android.com/apk/res/android
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 | .*:name
68 |
69 | http://schemas.android.com/apk/res/android
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 | name
79 |
80 | ^$
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 | style
90 |
91 | ^$
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 | .*
101 |
102 | ^$
103 |
104 |
105 | BY_NAME
106 |
107 |
108 |
109 |
110 |
111 |
112 | .*
113 |
114 | http://schemas.android.com/apk/res/android
115 |
116 |
117 | ANDROID_ATTRIBUTE_ORDER
118 |
119 |
120 |
121 |
122 |
123 |
124 | .*
125 |
126 | .*
127 |
128 |
129 | BY_NAME
130 |
131 |
132 |
133 |
134 |
135 |
136 |
137 |
138 |
139 |
--------------------------------------------------------------------------------
/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | Material-X
3 |
4 |
5 | A new dawn
6 | Random text about xyz doing xyz.Check out more details as xy dives deeper.
7 |
8 | Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do
9 | eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis
10 | nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure
11 | dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
12 | Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit
13 | anim id est laborum.
14 |
15 |
16 |
17 | Typography
18 | Typography Icon
19 | Headline 1
20 | Headline 2
21 | Headline 3
22 | Headline 4
23 | Headline 5
24 | Headline 6
25 | Subtitle 1
26 | Subtitle 2
27 | Body 1
28 | Body 2
29 | Caption
30 | Overline
31 | Button
32 | Letter Spacing Example
33 | Fun with font attributes
34 | Demo
35 | Reference
36 |
37 |
38 | Bookmark
39 | Explore
40 | Explore Articles
41 | Read More
42 | Category
43 | Select Preferred Mode
44 | Audio
45 | Video
46 | Text
47 | Buttons
48 | Favs Button
49 | Material Buttons
50 | Floating Action Buttons
51 |
52 |
53 | Vibrant Color
54 | Light Vibrant Color
55 | Dark Vibrant Color
56 | Dark Muted Color
57 | Light Muted Color
58 | Muted Color
59 | Color Palette
60 |
61 |
62 | Start
63 | Animations
64 | Object Animator
65 | Value Animator
66 | Animator Set
67 | Layout Transition
68 | Lottie Animations
69 |
70 |
71 | Enter Something
72 | Input
73 | Oops!! Check Input
74 | Favorites
75 |
76 |
77 | Bottom Navigation
78 | Home
79 | Search
80 | Settings
81 | Notifications
82 |
83 |
84 | Grids
85 | Selected Grid View Option
86 | Grid Items
87 |
88 |
89 | Motion
90 |
91 |
92 | Dialogs
93 | Alert Dialog
94 | Simple Dialog
95 | Confirmation Dialog
96 | Custom Dialog
97 | Multiple Choice Confirmation Dialog
98 |
99 |
--------------------------------------------------------------------------------
/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
7 |
8 |
12 |
13 |
14 |
18 |
19 |
23 |
24 |
28 |
29 |
33 |
34 |
37 |
38 |
41 |
42 |
45 |
46 |
47 |
52 |
53 |
58 |
59 |
64 |
65 |
71 |
72 |
73 |
76 |
77 |
78 |
81 |
82 |
85 |
86 |
90 |
91 |
94 |
95 |
99 |
100 |
104 |
--------------------------------------------------------------------------------
/app/src/main/java/com/github/odaridavid/materialx/dialogs/MaterialDialogsFragment.kt:
--------------------------------------------------------------------------------
1 | /**
2 | *
3 | * Copyright 2020 David Odari
4 | *
5 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
6 | * in compliance with the License. You may obtain a copy of the License at
7 | * http://www.apache.org/licenses/LICENSE-2.0
8 | * Unless required by applicable law or agreed to in writing, software distributed under the License
9 | * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
10 | * or implied. See the License for the specific language governing permissions and limitations under
11 | * the License.
12 | *
13 | **/
14 | package com.github.odaridavid.materialx.dialogs
15 |
16 | import android.app.Dialog
17 | import android.os.Bundle
18 | import android.view.View
19 | import androidx.fragment.app.DialogFragment
20 | import androidx.fragment.app.Fragment
21 | import com.github.odaridavid.materialx.R
22 | import com.github.odaridavid.materialx.commons.initButtonsStyle
23 | import com.google.android.material.button.MaterialButton
24 | import com.google.android.material.dialog.MaterialAlertDialogBuilder
25 |
26 |
27 | private interface IDialogController {
28 |
29 | fun toggleSimpleDialog()
30 |
31 | fun toggleAlertDialog()
32 |
33 | fun toggleConfirmationDialog()
34 |
35 | fun toggleMultipleChoiceConfirmationDialog()
36 |
37 | fun toggleCustomDialog()
38 |
39 | }
40 |
41 | internal class MaterialDialogsFragment : Fragment(R.layout.fragment_material_dialogs),
42 | IDialogController {
43 |
44 | private lateinit var alertDialogButton: MaterialButton
45 | private lateinit var simpleDialogButton: MaterialButton
46 | private lateinit var confirmationDialogButton: MaterialButton
47 | private lateinit var customDialogButton: MaterialButton
48 | private lateinit var multipleChoiceConfirmationButton: MaterialButton
49 |
50 | override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
51 | super.onViewCreated(view, savedInstanceState)
52 | with(view) {
53 | alertDialogButton = findViewById(R.id.alert_dialog_button)
54 | simpleDialogButton = findViewById(R.id.simple_dialog_button)
55 | confirmationDialogButton = findViewById(R.id.confirmation_dialog_button)
56 | customDialogButton = findViewById(R.id.custom_dialog_button)
57 | multipleChoiceConfirmationButton =
58 | findViewById(R.id.multiple_choice_confirmation_dialog_button)
59 | }
60 | initOnClickListeners()
61 | }
62 |
63 | private fun initOnClickListeners() {
64 | for ((button, onClick) in createButtonToClickListenerMap()) {
65 | button.setOnClickListener { onClick() }
66 | }
67 | }
68 |
69 | private fun createButtonToClickListenerMap(): Map Unit> {
70 | return mapOf(
71 | alertDialogButton to ::toggleAlertDialog,
72 | simpleDialogButton to ::toggleSimpleDialog,
73 | confirmationDialogButton to ::toggleConfirmationDialog,
74 | customDialogButton to ::toggleCustomDialog,
75 | multipleChoiceConfirmationButton to ::toggleMultipleChoiceConfirmationDialog
76 | )
77 | }
78 |
79 | override fun toggleAlertDialog() {
80 | MaterialAlertDialogBuilder(requireContext())
81 | .setTitle("Allow Chat Backup ?")
82 | .setMessage("Chats will be backed up every 48hrs.")
83 | .setNeutralButton("Skip", null)
84 | .setPositiveButton("Ok", null)
85 | .setNegativeButton("Cancel", null)
86 | .show()
87 | .initButtonsStyle()
88 | }
89 |
90 | override fun toggleSimpleDialog() {
91 | val levels = arrayOf("Easy", "Normal", "Difficult")
92 | MaterialAlertDialogBuilder(requireContext())
93 | .setTitle("Difficulty Level")
94 | .setItems(levels, null)
95 | .show()
96 | }
97 |
98 | override fun toggleConfirmationDialog() {
99 | val ringtones = arrayOf("Sunlight", "JukeBox", "Symphony", "Melody")
100 | val defaultCheckedItem = 1
101 | MaterialAlertDialogBuilder(requireContext())
102 | .setTitle("Phone Ringtone")
103 | .setNeutralButton("Cancel", null)
104 | .setPositiveButton("Ok", null)
105 | .setSingleChoiceItems(ringtones, defaultCheckedItem, null)
106 | .show()
107 | .initButtonsStyle()
108 | }
109 |
110 | override fun toggleMultipleChoiceConfirmationDialog() {
111 | val drinks = arrayOf("Tea", "Coffee", "Beer", "Wine")
112 | MaterialAlertDialogBuilder(requireContext())
113 | .setTitle("Drinks of choice")
114 | .setNeutralButton("Cancel", null)
115 | .setPositiveButton("Ok", null)
116 | .setMultiChoiceItems(drinks, null) { dialog, which, checked ->
117 | // Respond to item chosen
118 | }
119 | .show()
120 | .initButtonsStyle()
121 | }
122 |
123 | override fun toggleCustomDialog() {
124 | CustomDialog.show(childFragmentManager, "custom_dialog")
125 | }
126 |
127 | object CustomDialog : DialogFragment() {
128 | override fun onCreateDialog(savedInstanceState: Bundle?): Dialog =
129 | MaterialAlertDialogBuilder(
130 | requireContext(),
131 | R.style.ThemeOverlay_App_MaterialAlertDialog
132 | ).setView(R.layout.view_material_dialog).create()
133 | }
134 |
135 | }
136 |
137 |
138 |
139 |
--------------------------------------------------------------------------------
/gradlew:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env sh
2 |
3 | ##############################################################################
4 | ##
5 | ## Gradle start up script for UN*X
6 | ##
7 | ##############################################################################
8 |
9 | # Attempt to set APP_HOME
10 | # Resolve links: $0 may be a link
11 | PRG="$0"
12 | # Need this for relative symlinks.
13 | while [ -h "$PRG" ] ; do
14 | ls=`ls -ld "$PRG"`
15 | link=`expr "$ls" : '.*-> \(.*\)$'`
16 | if expr "$link" : '/.*' > /dev/null; then
17 | PRG="$link"
18 | else
19 | PRG=`dirname "$PRG"`"/$link"
20 | fi
21 | done
22 | SAVED="`pwd`"
23 | cd "`dirname \"$PRG\"`/" >/dev/null
24 | APP_HOME="`pwd -P`"
25 | cd "$SAVED" >/dev/null
26 |
27 | APP_NAME="Gradle"
28 | APP_BASE_NAME=`basename "$0"`
29 |
30 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
31 | DEFAULT_JVM_OPTS=""
32 |
33 | # Use the maximum available, or set MAX_FD != -1 to use that value.
34 | MAX_FD="maximum"
35 |
36 | warn () {
37 | echo "$*"
38 | }
39 |
40 | die () {
41 | echo
42 | echo "$*"
43 | echo
44 | exit 1
45 | }
46 |
47 | # OS specific support (must be 'true' or 'false').
48 | cygwin=false
49 | msys=false
50 | darwin=false
51 | nonstop=false
52 | case "`uname`" in
53 | CYGWIN* )
54 | cygwin=true
55 | ;;
56 | Darwin* )
57 | darwin=true
58 | ;;
59 | MINGW* )
60 | msys=true
61 | ;;
62 | NONSTOP* )
63 | nonstop=true
64 | ;;
65 | esac
66 |
67 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
68 |
69 | # Determine the Java command to use to start the JVM.
70 | if [ -n "$JAVA_HOME" ] ; then
71 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
72 | # IBM's JDK on AIX uses strange locations for the executables
73 | JAVACMD="$JAVA_HOME/jre/sh/java"
74 | else
75 | JAVACMD="$JAVA_HOME/bin/java"
76 | fi
77 | if [ ! -x "$JAVACMD" ] ; then
78 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
79 |
80 | Please set the JAVA_HOME variable in your environment to match the
81 | location of your Java installation."
82 | fi
83 | else
84 | JAVACMD="java"
85 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
86 |
87 | Please set the JAVA_HOME variable in your environment to match the
88 | location of your Java installation."
89 | fi
90 |
91 | # Increase the maximum file descriptors if we can.
92 | if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
93 | MAX_FD_LIMIT=`ulimit -H -n`
94 | if [ $? -eq 0 ] ; then
95 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
96 | MAX_FD="$MAX_FD_LIMIT"
97 | fi
98 | ulimit -n $MAX_FD
99 | if [ $? -ne 0 ] ; then
100 | warn "Could not set maximum file descriptor limit: $MAX_FD"
101 | fi
102 | else
103 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
104 | fi
105 | fi
106 |
107 | # For Darwin, add options to specify how the application appears in the dock
108 | if $darwin; then
109 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
110 | fi
111 |
112 | # For Cygwin, switch paths to Windows format before running java
113 | if $cygwin ; then
114 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
115 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
116 | JAVACMD=`cygpath --unix "$JAVACMD"`
117 |
118 | # We build the pattern for arguments to be converted via cygpath
119 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
120 | SEP=""
121 | for dir in $ROOTDIRSRAW ; do
122 | ROOTDIRS="$ROOTDIRS$SEP$dir"
123 | SEP="|"
124 | done
125 | OURCYGPATTERN="(^($ROOTDIRS))"
126 | # Add a user-defined pattern to the cygpath arguments
127 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then
128 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
129 | fi
130 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
131 | i=0
132 | for arg in "$@" ; do
133 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
134 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
135 |
136 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
137 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
138 | else
139 | eval `echo args$i`="\"$arg\""
140 | fi
141 | i=$((i+1))
142 | done
143 | case $i in
144 | (0) set -- ;;
145 | (1) set -- "$args0" ;;
146 | (2) set -- "$args0" "$args1" ;;
147 | (3) set -- "$args0" "$args1" "$args2" ;;
148 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
149 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
150 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
151 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
152 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
153 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
154 | esac
155 | fi
156 |
157 | # Escape application args
158 | save () {
159 | for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
160 | echo " "
161 | }
162 | APP_ARGS=$(save "$@")
163 |
164 | # Collect all arguments for the java command, following the shell quoting and substitution rules
165 | eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
166 |
167 | # by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
168 | if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
169 | cd "$(dirname "$0")"
170 | fi
171 |
172 | exec "$JAVACMD" "$@"
173 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_launcher_background.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
10 |
15 |
20 |
25 |
30 |
35 |
40 |
45 |
50 |
55 |
60 |
65 |
70 |
75 |
80 |
85 |
90 |
95 |
100 |
105 |
110 |
115 |
120 |
125 |
130 |
135 |
140 |
145 |
150 |
155 |
160 |
165 |
170 |
171 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/fragment_typography_reference.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
13 |
14 |
21 |
22 |
29 |
30 |
37 |
38 |
45 |
46 |
53 |
54 |
61 |
62 |
69 |
70 |
77 |
78 |
85 |
86 |
93 |
94 |
101 |
102 |
109 |
110 |
117 |
118 |
125 |
126 |
127 |
134 |
135 |
136 |
--------------------------------------------------------------------------------