├── .github
├── CODEOWNERS
├── release-template.yml
└── workflows
│ ├── devChecker.yml
│ ├── libVersionBump.yml
│ └── packagePublish.yml
├── .gitignore
├── .idea
├── codeStyles
│ ├── Project.xml
│ └── codeStyleConfig.xml
├── encodings.xml
└── vcs.xml
├── LICENSE
├── README.md
├── app
├── .gitignore
├── build.gradle
├── proguard-rules.pro
└── src
│ ├── androidTest
│ └── java
│ │ └── com
│ │ └── zomato
│ │ └── sushiapp
│ │ ├── ComponentActivityTest.kt
│ │ ├── ExampleInstrumentedTest.kt
│ │ └── MainActivityTest.kt
│ ├── main
│ ├── AndroidManifest.xml
│ ├── ic_launcher-web.png
│ ├── java
│ │ └── com
│ │ │ └── zomato
│ │ │ └── sushiapp
│ │ │ ├── ComponentActivity.kt
│ │ │ ├── DemoPullCollapsibleActivity.kt
│ │ │ ├── MainActivity.kt
│ │ │ ├── MainFragmentProvider.kt
│ │ │ ├── SplashActivity.kt
│ │ │ ├── fragments
│ │ │ ├── AboutSushiFragment.kt
│ │ │ ├── AboutZomatoFragment.kt
│ │ │ ├── ButtonStyleFragment.kt
│ │ │ ├── CardStackFragment.kt
│ │ │ ├── ColorPaletteFragment.kt
│ │ │ ├── FormComponentFragment.kt
│ │ │ ├── HomeFragment.kt
│ │ │ ├── ListingFragment.kt
│ │ │ ├── NavigationComponentsFragment.kt
│ │ │ ├── TagsFragment.kt
│ │ │ ├── buttons
│ │ │ │ ├── ButtonStyleFragment.kt
│ │ │ │ └── ButtonsMainFragment.kt
│ │ │ ├── images
│ │ │ │ └── ImagesMainFragment.kt
│ │ │ └── typography
│ │ │ │ ├── TypographyMainFragment.kt
│ │ │ │ └── TypographyStyleFragment.kt
│ │ │ └── viewimpls
│ │ │ └── DemoCollapsingCardStack.kt
│ └── res
│ │ ├── color
│ │ └── bottom_nav_item_color_selector.xml
│ │ ├── drawable-hdpi
│ │ ├── ic_topnav_bars.webp
│ │ ├── ic_topnav_buttons.webp
│ │ ├── ic_topnav_colors.webp
│ │ ├── ic_topnav_forms.webp
│ │ ├── ic_topnav_images.webp
│ │ ├── ic_topnav_snippets.webp
│ │ ├── ic_topnav_star.webp
│ │ └── ic_topnav_typography.webp
│ │ ├── drawable-xhdpi
│ │ ├── bg_splash_image.webp
│ │ ├── ic_topnav_bars.webp
│ │ ├── ic_topnav_buttons.webp
│ │ ├── ic_topnav_colors.webp
│ │ ├── ic_topnav_forms.webp
│ │ ├── ic_topnav_images.webp
│ │ ├── ic_topnav_snippets.webp
│ │ ├── ic_topnav_star.webp
│ │ ├── ic_topnav_typography.webp
│ │ ├── sushi_cover_image.webp
│ │ └── text_splash.webp
│ │ ├── drawable-xxhdpi
│ │ ├── bg_splash_image.webp
│ │ ├── ic_topnav_bars.png
│ │ ├── ic_topnav_buttons.png
│ │ ├── ic_topnav_colors.png
│ │ ├── ic_topnav_forms.png
│ │ ├── ic_topnav_images.png
│ │ ├── ic_topnav_snippets.png
│ │ ├── ic_topnav_star.png
│ │ ├── ic_topnav_typography.png
│ │ ├── sushi_cover_image.png
│ │ └── text_splash.webp
│ │ ├── drawable-xxxhdpi
│ │ ├── bg_splash_image.webp
│ │ ├── ic_topnav_bars.webp
│ │ ├── ic_topnav_buttons.webp
│ │ ├── ic_topnav_colors.webp
│ │ ├── ic_topnav_forms.webp
│ │ ├── ic_topnav_images.webp
│ │ ├── ic_topnav_snippets.webp
│ │ ├── ic_topnav_star.webp
│ │ ├── ic_topnav_typography.webp
│ │ ├── sushi_cover_image.webp
│ │ └── text_splash.webp
│ │ ├── drawable
│ │ ├── bg_food.webp
│ │ ├── bg_pattern1.png
│ │ ├── bg_pattern2.png
│ │ ├── bg_sample1.xml
│ │ ├── bg_sample2.xml
│ │ ├── bg_splash_screen.xml
│ │ ├── ic_buttons.xml
│ │ ├── ic_circle_cross.xml
│ │ ├── ic_color_palette.xml
│ │ ├── ic_image_views.xml
│ │ ├── ic_launcher_background.xml
│ │ ├── ic_launcher_foreground.xml
│ │ ├── ic_listings.xml
│ │ ├── ic_search.xml
│ │ ├── ic_tags.xml
│ │ ├── ic_text_fields.xml
│ │ ├── ic_text_styles.xml
│ │ ├── logo_zomato.xml
│ │ ├── side_nav_bar.xml
│ │ └── wordmark_zomato.png
│ │ ├── font
│ │ ├── okra.xml
│ │ ├── okra_bold.ttf
│ │ ├── okra_extrabold.ttf
│ │ ├── okra_extralight.ttf
│ │ ├── okra_light.ttf
│ │ ├── okra_medium.ttf
│ │ ├── okra_regular.ttf
│ │ ├── okra_semibold.ttf
│ │ ├── okra_thin.ttf
│ │ └── wasabi.ttf
│ │ ├── layout
│ │ ├── activity_component.xml
│ │ ├── activity_demo_pull_collapsible.xml
│ │ ├── activity_main.xml
│ │ ├── app_bar_main.xml
│ │ ├── content_main.xml
│ │ ├── fragment_about_sushi.xml
│ │ ├── fragment_about_zomato.xml
│ │ ├── fragment_buttons.xml
│ │ ├── fragment_buttons_outline.xml
│ │ ├── fragment_buttons_solid.xml
│ │ ├── fragment_buttons_text.xml
│ │ ├── fragment_card_stack.xml
│ │ ├── fragment_card_stack2.xml
│ │ ├── fragment_color_palette.xml
│ │ ├── fragment_image_views.xml
│ │ ├── fragment_listing.xml
│ │ ├── fragment_main.xml
│ │ ├── fragment_nav_components.xml
│ │ ├── fragment_tag.xml
│ │ ├── fragment_text_fields.xml
│ │ ├── fragment_typography.xml
│ │ ├── fragment_typography_style_bold.xml
│ │ ├── fragment_typography_style_extrabold.xml
│ │ ├── fragment_typography_style_extralight.xml
│ │ ├── fragment_typography_style_light.xml
│ │ ├── fragment_typography_style_medium.xml
│ │ ├── fragment_typography_style_regular.xml
│ │ ├── fragment_typography_style_semibold.xml
│ │ ├── layout_heading_large_tag.xml
│ │ ├── layout_seperator.xml
│ │ ├── list_item_dummy_about.xml
│ │ ├── list_item_stackable_card.xml
│ │ └── nav_header_main.xml
│ │ ├── menu
│ │ ├── activity_main_drawer.xml
│ │ └── main.xml
│ │ ├── mipmap-anydpi-v26
│ │ ├── ic_launcher.xml
│ │ └── ic_launcher_round.xml
│ │ ├── mipmap-hdpi
│ │ ├── ic_launcher.png
│ │ ├── ic_launcher_background.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-mdpi
│ │ ├── ic_launcher.png
│ │ ├── ic_launcher_background.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-xhdpi
│ │ ├── ic_launcher.png
│ │ ├── ic_launcher_background.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-xxhdpi
│ │ ├── ic_launcher.png
│ │ ├── ic_launcher_background.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-xxxhdpi
│ │ ├── ic_launcher.png
│ │ ├── ic_launcher_background.png
│ │ └── ic_launcher_round.png
│ │ ├── values-night
│ │ ├── bools.xml
│ │ ├── colors.xml
│ │ └── strings.xml
│ │ ├── values-v23
│ │ └── styles.xml
│ │ └── values
│ │ ├── bools.xml
│ │ ├── colors.xml
│ │ ├── dimens.xml
│ │ ├── strings.xml
│ │ └── styles.xml
│ └── test
│ └── java
│ └── com
│ └── zomato
│ └── sushiapp
│ ├── ExampleUnitTest.kt
│ └── MainFragmentProviderTest.kt
├── build.gradle
├── design-assets
└── wasabi
│ ├── Read Me.txt
│ ├── demo-files
│ ├── demo.css
│ └── demo.js
│ ├── demo.html
│ ├── fonts
│ ├── wasabi.eot
│ ├── wasabi.svg
│ ├── wasabi.ttf
│ └── wasabi.woff
│ ├── selection.json
│ └── style.css
├── gradle.properties
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
├── jacoco.gradle
├── localPublish.sh
├── settings.gradle
├── sushilib
├── .gitignore
├── build.gradle
├── lint-baseline.xml
├── proguard-consumer-rules.pro
├── proguard-rules.pro
├── publish.gradle
└── src
│ ├── androidTest
│ └── java
│ │ └── com
│ │ └── zomato
│ │ └── sushilib
│ │ └── ExampleInstrumentedTest.java
│ ├── main
│ ├── AndroidManifest.xml
│ ├── java
│ │ └── com
│ │ │ └── zomato
│ │ │ └── sushilib
│ │ │ ├── annotations
│ │ │ ├── ButtonDimension.java
│ │ │ ├── ButtonType.java
│ │ │ ├── CheckableSelectorType.java
│ │ │ ├── ColorName.java
│ │ │ ├── ColorTint.java
│ │ │ ├── FontWeight.java
│ │ │ ├── OutlineType.java
│ │ │ ├── TagSize.java
│ │ │ ├── TagType.java
│ │ │ └── TextViewOrientation.java
│ │ │ ├── atoms
│ │ │ ├── buttons
│ │ │ │ └── SushiButton.kt
│ │ │ ├── drawables
│ │ │ │ └── SushiIconDrawable.kt
│ │ │ ├── imageviews
│ │ │ │ ├── SushiCircleImageView.kt
│ │ │ │ └── SushiRoundedImageView.kt
│ │ │ ├── menu
│ │ │ │ └── SushiMenuItem.kt
│ │ │ ├── textviews
│ │ │ │ ├── SushiAutoContrastTextView.kt
│ │ │ │ ├── SushiIconTextView.kt
│ │ │ │ └── SushiTextView.kt
│ │ │ └── views
│ │ │ │ ├── RoundedView.kt
│ │ │ │ └── SushiIconActionProvider.kt
│ │ │ ├── molecules
│ │ │ ├── inputfields
│ │ │ │ ├── SushiCheckBox.kt
│ │ │ │ ├── SushiCheckableStrip.kt
│ │ │ │ ├── SushiCheckableStripGroup.kt
│ │ │ │ ├── SushiCheckableStripRadioGroup.kt
│ │ │ │ ├── SushiRadioButton.kt
│ │ │ │ ├── SushiSwitch.kt
│ │ │ │ └── SushiTextInputField.kt
│ │ │ ├── listings
│ │ │ │ ├── SushiIconListing.kt
│ │ │ │ ├── SushiImageTextListing.kt
│ │ │ │ ├── SushiLabeledStrip.kt
│ │ │ │ └── SushiTextListing.kt
│ │ │ └── tags
│ │ │ │ ├── SushiCircleIconView.kt
│ │ │ │ └── SushiTag.kt
│ │ │ ├── organisms
│ │ │ ├── navigation
│ │ │ │ ├── SushiBottomNavigationBar.kt
│ │ │ │ ├── SushiBottomNavigationView.kt
│ │ │ │ └── SushiTabLayout.kt
│ │ │ ├── ratings
│ │ │ │ └── SushiRatingBar.kt
│ │ │ └── stacks
│ │ │ │ ├── AnimationConstants.kt
│ │ │ │ ├── ExpandedItem.kt
│ │ │ │ ├── InternalPageCallbacks.kt
│ │ │ │ ├── SushiCollapsingCardStack.kt
│ │ │ │ └── page
│ │ │ │ ├── BaseExpandablePageLayout.kt
│ │ │ │ ├── ExpandablePageLayout.kt
│ │ │ │ ├── PageStateChangeCallbacks.kt
│ │ │ │ ├── PullCollapsibleActivityHelper.kt
│ │ │ │ ├── PullToCollapseListener.kt
│ │ │ │ ├── StandaloneExpandablePageLayout.kt
│ │ │ │ └── SushiPullCollapsibleActivity.kt
│ │ │ └── utils
│ │ │ ├── color
│ │ │ ├── ColorBuilder.kt
│ │ │ └── ColorContrastUtils.kt
│ │ │ ├── dimens
│ │ │ └── DimenUtils.kt
│ │ │ ├── text
│ │ │ └── TextFormatUtils.kt
│ │ │ ├── theme
│ │ │ └── ResourceThemeResolver.kt
│ │ │ ├── view
│ │ │ ├── SushiViewOutlineProvider.kt
│ │ │ └── ViewUtils.kt
│ │ │ └── widgets
│ │ │ ├── ButtonStyleUtils.kt
│ │ │ ├── CompoundButtonHelper.kt
│ │ │ ├── CompoundButtonUtils.kt
│ │ │ ├── DrawableSetters.kt
│ │ │ ├── TagStyleUtils.kt
│ │ │ └── TextViewUtils.kt
│ └── res
│ │ ├── animator
│ │ ├── sushi_click_depress_animator.xml
│ │ └── sushi_text_button_click_animator.xml
│ │ ├── color
│ │ ├── sushi_bottom_nav_text_color_selector.xml
│ │ └── sushi_rating_color_selector.xml
│ │ ├── drawable
│ │ ├── sushi_rounded_icon_bg.xml
│ │ └── sushi_text_cursor.xml
│ │ ├── layout
│ │ └── layout_bottom_navigation_bar_tab_view.xml
│ │ ├── values-night
│ │ ├── colors_button.xml
│ │ └── styles.xml
│ │ └── values
│ │ ├── attrs.xml
│ │ ├── attrs_bottomnav.xml
│ │ ├── attrs_button.xml
│ │ ├── attrs_compund_btn.xml
│ │ ├── attrs_edittext.xml
│ │ ├── attrs_fonts.xml
│ │ ├── attrs_imageview.xml
│ │ ├── attrs_listings.xml
│ │ ├── attrs_tag.xml
│ │ ├── attrs_textview.xml
│ │ ├── colors.xml
│ │ ├── colors_button.xml
│ │ ├── dimens.xml
│ │ ├── dimens_button.xml
│ │ ├── dimens_listings.xml
│ │ ├── dimens_tags.xml
│ │ ├── iconfont_mapping.xml
│ │ ├── strings.xml
│ │ ├── styles.xml
│ │ ├── styles_bottomnav.xml
│ │ ├── styles_button.xml
│ │ ├── styles_listings.xml
│ │ ├── styles_tablayout.xml
│ │ ├── styles_tags.xml
│ │ ├── styles_text.xml
│ │ └── styles_textfields.xml
│ └── test
│ └── java
│ └── com
│ └── zomato
│ └── sushilib
│ ├── ExampleUnitTest.java
│ └── utils
│ └── color
│ └── ColorContrastUtilsTests.kt
└── version.properties
/.github/CODEOWNERS:
--------------------------------------------------------------------------------
1 | ## Lines starting with '#' are comments.
2 | ## Each line is a file pattern followed by one or more owners.
3 |
4 | ## These owners will be the default owners for everything in the repo.
5 | # * @gunjanpatidar
6 |
7 | ## Order is important. The last matching pattern has the most precedence.
8 | ## So if a pull request only touches javascript files, only these owners
9 | ## will be requested to review.
10 | # *.js @octocat @github/js
11 |
12 | ## You can also use email addresses if you prefer.
13 | # docs/* docs@example.com
14 |
15 | ## ----------------------------------------------------------------------------
16 |
17 |
18 | * @paranoidbeing @apoorv-arora @asheeshzomato
19 |
--------------------------------------------------------------------------------
/.github/release-template.yml:
--------------------------------------------------------------------------------
1 | name-template: 'Release v$RESOLVED_VERSION'
2 | tag-template: 'v$RESOLVED_VERSION'
3 | categories:
4 | - title: '🚀 **Features** '
5 | labels:
6 | - 'New Feature'
7 | - title: '🐛 **Bug Fixes** '
8 | labels:
9 | - 'Bug'
10 | - 'Crash/ANR/Non-fatal'
11 | - 'UI Fix'
12 | - title: '🧰 **Tracking/Enhancements** '
13 | labels:
14 | - 'Enhancement'
15 | - 'Tracking'
16 | - title: '💻 **Platform** '
17 | labels:
18 | - 'Platform'
19 | change-template: '- $TITLE @$AUTHOR (#$NUMBER)'
20 | template: |
21 | ## 🌟 **What's new***
22 | $CHANGES
--------------------------------------------------------------------------------
/.github/workflows/devChecker.yml:
--------------------------------------------------------------------------------
1 | name: Android CI
2 |
3 | on:
4 | push:
5 | branches:
6 | - dev
7 | pull_request:
8 | branches:
9 | - dev
10 |
11 | env:
12 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
13 |
14 | jobs:
15 | build:
16 |
17 | runs-on: ubuntu-latest
18 |
19 | steps:
20 | - name: Cancel previous job
21 | uses: styfle/cancel-workflow-action@0.8.0
22 | with:
23 | access_token: ${{ secrets.GITHUB_TOKEN }}
24 | ignore_sha: true
25 |
26 | - uses: actions/checkout@v2
27 | with:
28 | token: ${{ secrets.GITHUB_TOKEN }}
29 |
30 | - name: Set up JDK 11
31 | uses: actions/setup-java@v2
32 | with:
33 | java-version: 11
34 | distribution: 'adopt'
35 |
36 | - name: Lint
37 | run: ./gradlew lintDebug
38 |
39 | - name: Build with Gradle
40 | if: success()
41 | run: ./gradlew assembleDebug
42 |
--------------------------------------------------------------------------------
/.github/workflows/libVersionBump.yml:
--------------------------------------------------------------------------------
1 | name: Version Bump CI
2 |
3 | on : workflow_dispatch
4 |
5 | env:
6 | READ_ARTIFACTS_TOKEN: ${{ secrets.READ_ARTIFACTS_TOKEN }}
7 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
8 |
9 | jobs:
10 | versionBump:
11 | runs-on: ubuntu-latest
12 |
13 | steps:
14 | - name: Cancel previous job
15 | uses: styfle/cancel-workflow-action@0.8.0
16 | with:
17 | access_token: ${{ secrets.GITHUB_TOKEN }}
18 | ignore_sha: true
19 |
20 | - name: Checkout repo
21 | uses: actions/checkout@v2
22 | with:
23 | token: ${{ secrets.GITHUB_TOKEN }}
24 |
25 | - name: Get tag and create release PR
26 | uses: Zomato/android-lib-release-action@master
27 | with:
28 | github_token: ${{ secrets.GITHUB_TOKEN }}
29 | default_branch: dev
30 | main_branch: master
31 | version_file_path: version.properties
32 |
--------------------------------------------------------------------------------
/.github/workflows/packagePublish.yml:
--------------------------------------------------------------------------------
1 | name: Package Publish CI
2 |
3 | on:
4 | push:
5 | branches:
6 | - master
7 |
8 | env:
9 | READ_ARTIFACTS_TOKEN: ${{ secrets.READ_ARTIFACTS_TOKEN }}
10 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
11 | AWS_OWNER: ${{ secrets.AWS_OWNER }}
12 |
13 | jobs:
14 | publish:
15 | runs-on: ubuntu-latest
16 |
17 | steps:
18 | - name: Cancel previous job
19 | uses: styfle/cancel-workflow-action@0.8.0
20 | with:
21 | access_token: ${{ secrets.GITHUB_TOKEN }}
22 | ignore_sha: true
23 |
24 | - uses: actions/checkout@v2
25 | with:
26 | token: ${{ secrets.GITHUB_TOKEN }}
27 |
28 | - name: Set up JDK 11
29 | uses: actions/setup-java@v2
30 | with:
31 | java-version: 11
32 | distribution: 'adopt'
33 |
34 | - name: Configure AWS Credentials
35 | uses: aws-actions/configure-aws-credentials@v1
36 | with:
37 | aws-access-key-id: ${{ secrets.ARTIFACT_ACCESS_KEY_ID }}
38 | aws-secret-access-key: ${{ secrets.ARTIFACT_SECRET_ACCESS_KEY }}
39 | aws-region: ${{ secrets.ARTIFACT_REGION }}
40 |
41 | - name: Setup env
42 | run: |
43 | source version.properties
44 | version=$(echo $VERSION_NAME)
45 | echo "VERSION_NAME=$version" >> $GITHUB_ENV
46 |
47 | aar_file="sushilib/build/outputs/aar/sushilib-release.aar"
48 | file_name="sushi-v$version"
49 |
50 | echo "AAR_PATH=$aar_file" >> $GITHUB_ENV
51 | echo "FILE_NAME=$file_name" >> $GITHUB_ENV
52 |
53 | CODEARTIFACT_AUTH_TOKEN="$(aws codeartifact get-authorization-token --domain zartifacts --domain-owner ${{ secrets.AWS_OWNER }} --query authorizationToken --duration-seconds 900 --output text)"
54 | echo "::add-mask::$CODEARTIFACT_AUTH_TOKEN"
55 | echo "CODEARTIFACT_AUTH_TOKEN=$CODEARTIFACT_AUTH_TOKEN" >> $GITHUB_ENV
56 |
57 | - name: Build with Gradle
58 | run: |
59 | ./gradlew sushilib:assembleRelease sushilib:assembleExternal
60 |
61 | - name: Publish the new package
62 | if: success()
63 | env:
64 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
65 | AWS_OWNER: ${{ secrets.AWS_OWNER }}
66 | run: |
67 | ./gradlew sushilib:publish
68 |
69 | - name: Release library
70 | if: success()
71 | uses: Zomato/treeware@master
72 | with:
73 | prod_branch: dev
74 | should_release: true
75 | drafter_path: .github/release-template.yml
76 | assets: ${{ env.AAR_PATH }}#${{ env.FILE_NAME }}
77 | version_name: ${{ env.VERSION_NAME }}
78 |
79 | - name: Master branch syncup PR
80 | uses: Zomato/android-lib-release-action@v5
81 | with:
82 | github_token: ${{ secrets.GITHUB_TOKEN }}
83 | default_branch: dev
84 | main_branch: master
85 | version_file_path: version.properties
86 | create_sync_pr: true
87 |
--------------------------------------------------------------------------------
/.idea/codeStyles/codeStyleConfig.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/.idea/encodings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 |
2 |
3 | # Sushi Design System
4 | ⚡️ Android UI Kit ⚡️
5 |
6 | Application is available here:
7 |
8 |

9 |
10 | [](https://play.google.com/store/apps/details?id=com.zomato.sushiapp) [](https://play.google.com/store/apps/details?id=com.zomato.sushiapp)
11 |
12 | Latest release:
13 |
14 | 
15 |
16 |
17 |
18 | ## Usage
19 | The master branch is being used for release and dev is the default branch.
20 |
21 | ### Installation
22 | This package is available via Github Package Registry. To use this, follow these steps.
23 |
24 | Add the Github Maven repository and the dependency in your app's build.gradle
25 |
26 | ```groovy
27 | repositories {
28 | // ... google(), jcenter() etc
29 | maven {
30 | url "https://maven.pkg.github.com/Zomato/sushi-ui-android"
31 | credentials(HttpHeaderCredentials) {
32 | name = "Authorization"
33 | value = "token ${System.getenv("GITHUB_TOKEN")}"
34 | }
35 | authentication { header(HttpHeaderAuthentication) }
36 | }
37 | }
38 |
39 | dependencies {
40 | // ... other dependencies
41 | implementation "com.zomato.sushilib:sushilib-android:${latest_version}"
42 | }
43 |
44 | ```
45 |
46 | > NOTE: Make sure you have the `GITHUB_TOKEN` environment variable set. This token should have `read:packages` enabled.
47 |
48 |
49 | ## Documentation
50 | A delicious UI Kit to build Android apps. Made with ❤ by Zomato
51 |
52 |
53 | ## Testing & Coverage
54 |
55 | Run all tests and get coverage report
56 | ```shell
57 | ./gradlew jacocoTestReport
58 | ```
59 |
60 | ## Publishing
61 | To publish this package, go to Actions tab of the repo and select "Version Bump CI" workflow. This workflow has to be manually triggered by clicking "Run Workflow" button. It will create a PR on "master" branch which after merge will generate and publish a new package.
62 |
63 | ## License
64 |
65 | ```
66 | Copyright 2022 Zomato Limited.
67 |
68 | Licensed under the Apache License, Version 2.0 (the "License");
69 | you may not use this file except in compliance with the License.
70 | You may obtain a copy of the License at
71 |
72 | http://www.apache.org/licenses/LICENSE-2.0
73 |
74 | Unless required by applicable law or agreed to in writing, software
75 | distributed under the License is distributed on an "AS IS" BASIS,
76 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
77 | See the License for the specific language governing permissions and
78 | limitations under the License.
79 | ```
80 |
81 |
--------------------------------------------------------------------------------
/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/app/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 | apply plugin: 'kotlin-android'
3 | apply plugin: 'kotlin-android-extensions'
4 | apply from: "../jacoco.gradle"
5 |
6 | def rootConfiguration = rootProject.ext
7 |
8 | android {
9 | compileSdkVersion rootConfiguration.compileSdkVersion
10 |
11 | defaultConfig {
12 | applicationId "com.zomato.sushiapp"
13 | minSdkVersion rootConfiguration.minSdkVersion
14 | targetSdkVersion rootConfiguration.targetSdkVersion
15 |
16 | versionCode 1
17 | versionName "1.0"
18 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
19 | vectorDrawables.useSupportLibrary = true
20 | }
21 | buildTypes {
22 | release {
23 | minifyEnabled false
24 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
25 | }
26 | debug {
27 | testCoverageEnabled true
28 | }
29 | }
30 | compileOptions {
31 | sourceCompatibility JavaVersion.VERSION_11
32 | targetCompatibility JavaVersion.VERSION_11
33 | }
34 |
35 | testOptions {
36 | execution 'ANDROIDX_TEST_ORCHESTRATOR'
37 | animationsDisabled true
38 |
39 | unitTests {
40 | includeAndroidResources = true
41 | }
42 | }
43 | }
44 |
45 | dependencies {
46 | implementation fileTree(include: ['*.jar'], dir: 'libs')
47 | implementation project(':sushilib')
48 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
49 | implementation "androidx.appcompat:appcompat:${rootConfiguration.appCompatVersion}"
50 | implementation "com.google.android.material:material:${rootConfiguration.materialVersion}"
51 | implementation "androidx.viewpager:viewpager:${rootConfiguration.viewPagerVersion}"
52 | implementation "androidx.fragment:fragment:${rootConfiguration.fragmentVersion}"
53 | implementation "androidx.constraintlayout:constraintlayout:${rootConfiguration.constraintLayoutVersion}"
54 |
55 | testImplementation "org.robolectric:robolectric:${rootConfiguration.robolectricVersion}"
56 | testImplementation "junit:junit:${rootConfiguration.jUnitVersion}"
57 |
58 | androidTestUtil "androidx.test:orchestrator:1.1.0"
59 | androidTestImplementation "androidx.test:rules:${rootConfiguration.testRunnerVersion}"
60 | androidTestImplementation "androidx.test:runner:${rootConfiguration.testRunnerVersion}"
61 | androidTestImplementation "androidx.test.espresso:espresso-core:${rootConfiguration.espressoVersion}"
62 | }
63 |
--------------------------------------------------------------------------------
/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
22 |
--------------------------------------------------------------------------------
/app/src/androidTest/java/com/zomato/sushiapp/ComponentActivityTest.kt:
--------------------------------------------------------------------------------
1 | package com.zomato.sushiapp
2 |
3 | import android.content.Intent
4 | import androidx.test.InstrumentationRegistry
5 | import androidx.test.rule.ActivityTestRule
6 | import androidx.test.runner.AndroidJUnit4
7 | import org.junit.Assert.assertNotNull
8 | import org.junit.Rule
9 | import org.junit.Test
10 | import org.junit.runner.RunWith
11 |
12 | /**
13 | * created by championswimmer on 2019-05-10
14 | * Copyright (c) 2019 Zomato Media Pvt. Ltd.
15 | */
16 | @RunWith(AndroidJUnit4::class)
17 | class ComponentActivityTest {
18 |
19 | @Rule
20 | @JvmField
21 | val activityTestRule = ActivityTestRule(ComponentActivity::class.java, false, false)
22 |
23 | @JvmField
24 | val appContext = InstrumentationRegistry.getTargetContext()
25 |
26 |
27 | fun getComponentIntent(componentName: Int) =
28 | Intent(appContext, ComponentActivity::class.java).apply {
29 | putExtra("type", componentName)
30 | addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
31 | appContext.startActivity(this)
32 | }
33 |
34 | @Test
35 | fun ComponentActivity_launch_COLORS() {
36 | assertNotNull(activityTestRule.launchActivity(getComponentIntent(ComponentActivity.COLORS)))
37 | }
38 |
39 | @Test
40 | fun ComponentActivity_launch_TYPOGRAPHY() {
41 | assertNotNull(activityTestRule.launchActivity(getComponentIntent(ComponentActivity.TYPOGRAPHY)))
42 | }
43 |
44 | @Test
45 | fun ComponentActivity_launch_IMAGES() {
46 | assertNotNull(activityTestRule.launchActivity(getComponentIntent(ComponentActivity.IMAGES)))
47 | }
48 |
49 | @Test
50 | fun ComponentActivity_launch_ICONS() {
51 | assertNotNull(activityTestRule.launchActivity(getComponentIntent(ComponentActivity.ICONS)))
52 | }
53 |
54 | @Test
55 | fun ComponentActivity_launch_BUTTONS() {
56 | assertNotNull(activityTestRule.launchActivity(getComponentIntent(ComponentActivity.BUTTONS)))
57 | }
58 |
59 | @Test
60 | fun ComponentActivity_launch_FORM() {
61 | assertNotNull(activityTestRule.launchActivity(getComponentIntent(ComponentActivity.FORM)))
62 | }
63 |
64 | @Test
65 | fun ComponentActivity_launch_SNIPPETS() {
66 | assertNotNull(activityTestRule.launchActivity(getComponentIntent(ComponentActivity.SNIPPETS)))
67 | }
68 |
69 | @Test
70 | fun ComponentActivity_launch_TAGS() {
71 | assertNotNull(activityTestRule.launchActivity(getComponentIntent(ComponentActivity.TAGS)))
72 | }
73 |
74 | @Test
75 | fun ComponentActivity_launch_MENU_TABS() {
76 | assertNotNull(activityTestRule.launchActivity(getComponentIntent(ComponentActivity.MENU_TABS)))
77 | }
78 | }
--------------------------------------------------------------------------------
/app/src/androidTest/java/com/zomato/sushiapp/ExampleInstrumentedTest.kt:
--------------------------------------------------------------------------------
1 | package com.zomato.sushiapp
2 |
3 | import androidx.test.InstrumentationRegistry
4 | import androidx.test.runner.AndroidJUnit4
5 | import org.junit.Assert.assertEquals
6 | import org.junit.Test
7 | import org.junit.runner.RunWith
8 |
9 | /**
10 | * Instrumented test, which will execute on an Android device.
11 | *
12 | * See [testing documentation](http://d.android.com/tools/testing).
13 | */
14 | @RunWith(AndroidJUnit4::class)
15 | class ExampleInstrumentedTest {
16 | @Test
17 | fun useAppContext() {
18 | // Context of the app under test.
19 | val appContext = InstrumentationRegistry.getTargetContext()
20 | assertEquals("com.zomato.sushiapp", appContext.packageName)
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/app/src/androidTest/java/com/zomato/sushiapp/MainActivityTest.kt:
--------------------------------------------------------------------------------
1 | package com.zomato.sushiapp
2 |
3 | import androidx.test.rule.ActivityTestRule
4 | import androidx.test.runner.AndroidJUnit4
5 | import org.junit.Assert.assertNotNull
6 | import org.junit.Rule
7 | import org.junit.Test
8 | import org.junit.runner.RunWith
9 |
10 | /**
11 | * created by championswimmer on 2019-05-10
12 | * Copyright (c) 2019 Zomato Media Pvt. Ltd.
13 | */
14 | @RunWith(AndroidJUnit4::class)
15 | class MainActivityTest {
16 |
17 | @Rule @JvmField
18 | val activityTestRule = ActivityTestRule(MainActivity::class.java)
19 |
20 | @Test
21 | fun MainActivity_launches() {
22 | assertNotNull(activityTestRule.activity)
23 | }
24 | }
--------------------------------------------------------------------------------
/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
12 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
25 |
26 |
27 |
30 |
33 |
34 |
35 |
--------------------------------------------------------------------------------
/app/src/main/ic_launcher-web.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Zomato/sushi-ui-android/3e976aa7b8b327826c3154b17b8c373987d0369a/app/src/main/ic_launcher-web.png
--------------------------------------------------------------------------------
/app/src/main/java/com/zomato/sushiapp/DemoPullCollapsibleActivity.kt:
--------------------------------------------------------------------------------
1 | package com.zomato.sushiapp
2 |
3 | import android.content.Context
4 | import android.content.Intent
5 | import android.graphics.Rect
6 | import android.os.Bundle
7 | import android.widget.LinearLayout
8 | import com.zomato.sushilib.organisms.stacks.page.SushiPullCollapsibleActivity
9 |
10 | /**
11 | * Created by prempal on 2019-07-24.
12 | */
13 | class DemoPullCollapsibleActivity : SushiPullCollapsibleActivity() {
14 |
15 | companion object {
16 | fun start(context: Context, expandFromRect: Rect) {
17 | val intent = Intent(context, DemoPullCollapsibleActivity::class.java)
18 | intent.putExtra(EXTRA_ENABLE_PULL_COLLAPSE, true)
19 | intent.putExtra(EXTRA_EXPAND_FROM_RECT, expandFromRect)
20 | context.startActivity(intent)
21 | }
22 | }
23 |
24 | override fun onCreate(savedInstanceState: Bundle?) {
25 | super.onCreate(savedInstanceState)
26 | setContentView(R.layout.activity_demo_pull_collapsible)
27 | }
28 |
29 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/zomato/sushiapp/MainFragmentProvider.kt:
--------------------------------------------------------------------------------
1 | package com.zomato.sushiapp
2 |
3 | import android.content.Context
4 | import androidx.fragment.app.Fragment
5 | import androidx.fragment.app.FragmentManager
6 | import com.zomato.sushiapp.fragments.AboutSushiFragment
7 | import com.zomato.sushiapp.fragments.AboutZomatoFragment
8 | import com.zomato.sushiapp.fragments.HomeFragment
9 | import com.zomato.sushilib.organisms.navigation.SushiBottomNavigationBar
10 | import com.zomato.sushilib.utils.theme.ResourceThemeResolver
11 |
12 | class MainFragmentProvider(private val context: Context, private val fm: FragmentManager) :
13 | SushiBottomNavigationBar.TabViewDataProvider {
14 |
15 | private val homeFragment by lazy { HomeFragment() }
16 | private val aboutZomatoFragment by lazy { AboutZomatoFragment() }
17 | private val aboutSushiFragment by lazy { AboutSushiFragment() }
18 |
19 | override fun getCount(): Int {
20 | return 3
21 | }
22 |
23 | override fun getTabData(position: Int): SushiBottomNavigationBar.TabViewData {
24 | return SushiBottomNavigationBar.TabViewData(
25 | getTitle(position), context.resources.getString(R.string.icon_unfilled_star),
26 | context.resources.getString(R.string.icon_unfilled_star),
27 | position,
28 | ResourceThemeResolver.getThemedColorFromAttr(
29 | context,
30 | android.R.attr.textColorPrimary
31 | ),
32 | ResourceThemeResolver.getThemedColorFromAttr(
33 | context,
34 | android.R.attr.textColorSecondary
35 | ),
36 | ResourceThemeResolver.getThemedColorFromAttr(
37 | context,
38 | android.R.attr.colorPrimary
39 | ),
40 | ResourceThemeResolver.getThemedColorFromAttr(
41 | context,
42 | android.R.attr.textColorSecondary
43 | )
44 | )
45 | }
46 |
47 | fun getItem(position: Int): Fragment {
48 | return when (position) {
49 | 0 -> homeFragment
50 | 1 -> aboutZomatoFragment
51 | 2 -> aboutSushiFragment
52 | else -> throw NotImplementedError()
53 | }
54 | }
55 |
56 | fun getTitle(position: Int): String {
57 | return when (position) {
58 | 0 -> "Sushi"
59 | 1 -> "Zomato"
60 | 2 -> "About"
61 | else -> throw NotImplementedError()
62 | }
63 | }
64 |
65 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/zomato/sushiapp/SplashActivity.kt:
--------------------------------------------------------------------------------
1 | package com.zomato.sushiapp
2 |
3 | import android.app.Activity
4 | import android.content.Intent
5 | import android.os.Bundle
6 | import android.os.Handler
7 |
8 | class SplashActivity : Activity() {
9 |
10 | override fun onCreate(savedInstanceState: Bundle?) {
11 | super.onCreate(savedInstanceState)
12 |
13 | Handler().postDelayed(
14 | {
15 | startActivity(Intent(this, MainActivity::class.java))
16 | finish()
17 | },
18 | 1000
19 | )
20 |
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/app/src/main/java/com/zomato/sushiapp/fragments/AboutSushiFragment.kt:
--------------------------------------------------------------------------------
1 | package com.zomato.sushiapp.fragments
2 |
3 | import android.os.Bundle
4 | import android.view.LayoutInflater
5 | import android.view.View
6 | import android.view.ViewGroup
7 | import androidx.core.content.res.ResourcesCompat
8 | import androidx.fragment.app.Fragment
9 | import com.zomato.sushiapp.R
10 | import kotlinx.android.synthetic.main.fragment_main.*
11 |
12 | class AboutSushiFragment : Fragment() {
13 |
14 | override fun onCreateView(
15 | inflater: LayoutInflater, container: ViewGroup?,
16 | savedInstanceState: Bundle?
17 | ): View? {
18 | // Inflate the layout for this fragment
19 | return inflater.inflate(R.layout.fragment_about_sushi, container, false)
20 | }
21 |
22 | override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
23 | super.onViewCreated(view, savedInstanceState)
24 | toolbar.title = "About"
25 |
26 | collapsible_toolbar.apply {
27 | setExpandedTitleTypeface(ResourcesCompat.getFont(context, R.font.okra_light))
28 | setCollapsedTitleTypeface(ResourcesCompat.getFont(context, R.font.okra_light))
29 | }
30 | }
31 |
32 |
33 | }
34 |
--------------------------------------------------------------------------------
/app/src/main/java/com/zomato/sushiapp/fragments/AboutZomatoFragment.kt:
--------------------------------------------------------------------------------
1 | package com.zomato.sushiapp.fragments
2 |
3 |
4 | import android.content.Intent
5 | import android.net.Uri
6 | import android.os.Bundle
7 | import android.view.LayoutInflater
8 | import android.view.View
9 | import android.view.ViewGroup
10 | import androidx.core.content.res.ResourcesCompat
11 | import androidx.fragment.app.Fragment
12 | import com.zomato.sushiapp.R
13 | import kotlinx.android.synthetic.main.fragment_about_zomato.*
14 |
15 | class AboutZomatoFragment : Fragment() {
16 |
17 | override fun onCreateView(
18 | inflater: LayoutInflater, container: ViewGroup?,
19 | savedInstanceState: Bundle?
20 | ): View? {
21 | // Inflate the layout for this fragment
22 | return inflater.inflate(R.layout.fragment_about_zomato, container, false)
23 | }
24 |
25 | override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
26 | super.onViewCreated(view, savedInstanceState)
27 | toolbar.title = "About Zomato"
28 |
29 | collapsible_toolbar.apply {
30 | setExpandedTitleTypeface(ResourcesCompat.getFont(context, R.font.okra_light))
31 | setCollapsedTitleTypeface(ResourcesCompat.getFont(context, R.font.okra_light))
32 | }
33 |
34 |
35 | btn_get_app.setOnClickListener {
36 | with(Intent()) {
37 | action = Intent.ACTION_VIEW
38 | data = Uri.parse("https://play.google.com/store/apps/details?id=com.application.zomato")
39 | startActivity(this)
40 | }
41 | }
42 | }
43 |
44 | }
45 |
--------------------------------------------------------------------------------
/app/src/main/java/com/zomato/sushiapp/fragments/ButtonStyleFragment.kt:
--------------------------------------------------------------------------------
1 | package com.zomato.sushiapp.fragments
2 |
3 | import androidx.fragment.app.Fragment
4 |
5 | class ButtonStyleFragment : Fragment() {
6 |
7 | companion object {
8 | fun newInstance(): ButtonStyleFragment {
9 | val fragment = ButtonStyleFragment()
10 | return fragment
11 | }
12 | }
13 |
14 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/zomato/sushiapp/fragments/ColorPaletteFragment.kt:
--------------------------------------------------------------------------------
1 | package com.zomato.sushiapp.fragments
2 |
3 |
4 | import android.os.Bundle
5 | import android.view.LayoutInflater
6 | import android.view.View
7 | import android.view.ViewGroup
8 | import androidx.fragment.app.Fragment
9 | import com.zomato.sushiapp.R
10 | import com.zomato.sushilib.annotations.ColorName
11 | import com.zomato.sushilib.utils.color.ColorBuilder
12 |
13 | /**
14 | * A simple [Fragment] subclass.
15 | *
16 | */
17 | class ColorPaletteFragment : Fragment() {
18 |
19 | override fun onCreateView(
20 | inflater: LayoutInflater, container: ViewGroup?,
21 | savedInstanceState: Bundle?
22 | ): View? {
23 | // Sample code to see how color builder works
24 | ColorBuilder(requireContext(), ColorName.RED, 100).build()
25 | ColorBuilder(requireContext()).setColor(ColorName.BLUE).setTint(300).build()
26 |
27 | // Inflate the layout for this fragment
28 | return inflater.inflate(R.layout.fragment_color_palette, container, false)
29 | }
30 |
31 |
32 | }
33 |
--------------------------------------------------------------------------------
/app/src/main/java/com/zomato/sushiapp/fragments/FormComponentFragment.kt:
--------------------------------------------------------------------------------
1 | package com.zomato.sushiapp.fragments
2 |
3 |
4 | import android.os.Bundle
5 | import android.text.TextUtils
6 | import android.view.LayoutInflater
7 | import android.view.View
8 | import android.view.ViewGroup
9 | import android.widget.Toast
10 | import androidx.fragment.app.Fragment
11 | import com.zomato.sushiapp.R
12 | import com.zomato.sushilib.molecules.inputfields.SushiTextInputField
13 | import kotlinx.android.synthetic.main.fragment_text_fields.view.*
14 |
15 | /**
16 | * A simple [Fragment] subclass.
17 | *
18 | */
19 | class FormComponentFragment : Fragment() {
20 |
21 | override fun onCreateView(
22 | inflater: LayoutInflater, container: ViewGroup?,
23 | savedInstanceState: Bundle?
24 | ): View? {
25 | // Inflate the layout for this fragment
26 | val rootView = inflater.inflate(R.layout.fragment_text_fields, container, false)
27 |
28 | rootView.textFieldRecipient.setEdgeDrawableClickListener(
29 | object : SushiTextInputField.EdgeDrawableClickListener {
30 | override fun onDrawableStartClicked() {}
31 |
32 | override fun onDrawableEndClicked() {
33 | rootView.textFieldRecipient.editText?.setText("")
34 | }
35 |
36 | })
37 | rootView.textFieldPassword.setEdgeDrawableClickListener(
38 | object : SushiTextInputField.EdgeDrawableClickListener {
39 | override fun onDrawableStartClicked() {}
40 |
41 | override fun onDrawableEndClicked() {
42 | rootView.textFieldRecipient.editText?.setText("")
43 | }
44 |
45 | })
46 |
47 | rootView.textFieldRecipient.setTextValidator { text ->
48 | "Must be at least 5 characters".takeIf {
49 | TextUtils.isEmpty(text) || TextUtils.getTrimmedLength(text) < 5
50 | }
51 | }
52 | rootView.radioGroup.setOnCheckedChangeListener { group, id, isChecked ->
53 | val message = when (id) {
54 | R.id.radioPepsi -> "Pepsi"
55 | R.id.radioMountainDew -> "Mountain Dew"
56 | R.id.radioCocaCola -> "Coca Cola"
57 | else -> throw IllegalStateException()
58 | }
59 | Toast.makeText(context, "$isChecked $message", Toast.LENGTH_SHORT).show()
60 | }
61 | rootView.checkboxGroup.setOnCheckedChangeListener { group, id, isChecked ->
62 | if (isChecked) {
63 | val message = when (id) {
64 | R.id.checkPepsi -> "Pepsi"
65 | R.id.checkMountainDew -> "Mountain Dew"
66 | R.id.checkCocaCola -> "Coca Cola"
67 | else -> throw IllegalStateException()
68 | }
69 | Toast.makeText(context, message, Toast.LENGTH_SHORT).show()
70 | }
71 | }
72 | rootView.checkboxGroup.setOnMaxCheckedReachedListener {
73 | Toast.makeText(context, "You can only select max 2 options", Toast.LENGTH_SHORT).show()
74 | }
75 |
76 | return rootView
77 | }
78 |
79 |
80 | }
81 |
--------------------------------------------------------------------------------
/app/src/main/java/com/zomato/sushiapp/fragments/HomeFragment.kt:
--------------------------------------------------------------------------------
1 | package com.zomato.sushiapp.fragments
2 |
3 | import android.os.Bundle
4 | import android.view.LayoutInflater
5 | import android.view.View
6 | import android.view.ViewGroup
7 | import androidx.appcompat.app.AppCompatActivity
8 | import androidx.core.content.res.ResourcesCompat
9 | import androidx.fragment.app.Fragment
10 | import com.zomato.sushiapp.ComponentActivity
11 | import com.zomato.sushiapp.R
12 | import kotlinx.android.synthetic.main.fragment_main.*
13 | import kotlinx.android.synthetic.main.fragment_main.view.*
14 |
15 |
16 | class HomeFragment : Fragment() {
17 |
18 | private val clickListener = View.OnClickListener {
19 | val component = when (it.id) {
20 | R.id.nav_text_styles -> ComponentActivity.TYPOGRAPHY
21 | R.id.nav_text_fields -> ComponentActivity.FORM
22 | R.id.nav_color_palette -> ComponentActivity.COLORS
23 | R.id.nav_image_views -> ComponentActivity.IMAGES
24 | R.id.nav_buttons -> ComponentActivity.BUTTONS
25 | R.id.nav_tags -> ComponentActivity.TAGS
26 | R.id.nav_listing -> ComponentActivity.SNIPPETS
27 | R.id.nav_menu_tabs -> ComponentActivity.MENU_TABS
28 | R.id.nav_card_stack -> ComponentActivity.CARD_STACK
29 | else -> null
30 | }
31 | component ?: return@OnClickListener
32 | activity?.let {
33 |
34 | ComponentActivity.start(it, component)
35 |
36 | }
37 |
38 | }
39 |
40 | override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
41 | return inflater.inflate(R.layout.fragment_main, container, false)
42 | }
43 |
44 | override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
45 | super.onViewCreated(view, savedInstanceState)
46 |
47 | (activity as? AppCompatActivity)?.setSupportActionBar(view.toolbar)
48 |
49 | collapsible_toolbar.apply {
50 | setExpandedTitleTypeface(ResourcesCompat.getFont(context, R.font.okra_light))
51 | setCollapsedTitleTypeface(ResourcesCompat.getFont(context, R.font.okra_light))
52 | }
53 |
54 | view.apply {
55 | findViewById(R.id.nav_text_styles)?.setOnClickListener(clickListener)
56 | findViewById(R.id.nav_text_fields)?.setOnClickListener(clickListener)
57 | findViewById(R.id.nav_color_palette)?.setOnClickListener(clickListener)
58 | findViewById(R.id.nav_image_views)?.setOnClickListener(clickListener)
59 | findViewById(R.id.nav_buttons)?.setOnClickListener(clickListener)
60 | findViewById(R.id.nav_tags)?.setOnClickListener(clickListener)
61 | findViewById(R.id.nav_listing)?.setOnClickListener(clickListener)
62 | findViewById(R.id.nav_menu_tabs)?.setOnClickListener(clickListener)
63 | findViewById(R.id.nav_card_stack)?.setOnClickListener(clickListener)
64 | }
65 | }
66 |
67 | }
68 |
--------------------------------------------------------------------------------
/app/src/main/java/com/zomato/sushiapp/fragments/ListingFragment.kt:
--------------------------------------------------------------------------------
1 | package com.zomato.sushiapp.fragments
2 |
3 | import android.os.Bundle
4 | import android.view.LayoutInflater
5 | import android.view.View
6 | import android.view.ViewGroup
7 | import androidx.fragment.app.Fragment
8 | import com.zomato.sushiapp.R
9 |
10 | class ListingFragment : Fragment() {
11 | override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
12 | val rootView = inflater.inflate(R.layout.fragment_listing, container, false)
13 | return rootView
14 | }
15 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/zomato/sushiapp/fragments/NavigationComponentsFragment.kt:
--------------------------------------------------------------------------------
1 | package com.zomato.sushiapp.fragments
2 |
3 | import android.os.Bundle
4 | import android.view.LayoutInflater
5 | import android.view.View
6 | import android.view.ViewGroup
7 | import androidx.fragment.app.Fragment
8 | import com.zomato.sushiapp.R
9 | import com.zomato.sushilib.organisms.navigation.SushiBottomNavigationBar
10 | import com.zomato.sushilib.utils.theme.ResourceThemeResolver
11 | import kotlinx.android.synthetic.main.fragment_nav_components.*
12 |
13 | class NavigationComponentsFragment : Fragment(), SushiBottomNavigationBar.TabViewDataProvider {
14 |
15 | override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
16 | return inflater.inflate(R.layout.fragment_nav_components, container, false)
17 | }
18 |
19 | override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
20 | super.onViewCreated(view, savedInstanceState)
21 | bottom_nav_bar.setup(this)
22 | }
23 |
24 | override fun getCount(): Int {
25 | return 5
26 | }
27 |
28 | override fun getTabData(position: Int): SushiBottomNavigationBar.TabViewData {
29 |
30 | return SushiBottomNavigationBar.TabViewData(
31 | "Menu $position", resources.getString(R.string.icon_unfilled_star),
32 | resources.getString(R.string.icon_unfilled_star),
33 | position,
34 | context?.let {ResourceThemeResolver.getThemedColorFromAttr(
35 | it,
36 | android.R.attr.textColorPrimary
37 | ) } ?: 0,
38 | context?.let {ResourceThemeResolver.getThemedColorFromAttr(
39 | it,
40 | android.R.attr.textColorSecondary
41 | ) } ?: 0,
42 | context?.let {ResourceThemeResolver.getThemedColorFromAttr(
43 | it,
44 | android.R.attr.colorControlActivated
45 | ) } ?: 0,
46 | context?.let {ResourceThemeResolver.getThemedColorFromAttr(
47 | it,
48 | android.R.attr.textColorSecondary
49 | ) } ?: 0
50 | )
51 | }
52 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/zomato/sushiapp/fragments/buttons/ButtonsMainFragment.kt:
--------------------------------------------------------------------------------
1 | package com.zomato.sushiapp.fragments.buttons
2 |
3 | import android.os.Bundle
4 | import android.view.LayoutInflater
5 | import android.view.View
6 | import android.view.ViewGroup
7 | import androidx.fragment.app.Fragment
8 | import androidx.fragment.app.FragmentPagerAdapter
9 | import com.zomato.sushiapp.R
10 | import kotlinx.android.synthetic.main.fragment_buttons.view.*
11 |
12 | /**
13 | * A simple [Fragment] subclass.
14 | *
15 | */
16 | class ButtonsMainFragment : Fragment() {
17 |
18 | override fun onCreateView(
19 | inflater: LayoutInflater, container: ViewGroup?,
20 | savedInstanceState: Bundle?
21 | ): View? {
22 | // Inflate the layout for this fragment
23 | val rootView = inflater.inflate(R.layout.fragment_buttons, container, false)
24 | rootView.viewpager_buttons.adapter = object : FragmentPagerAdapter(childFragmentManager) {
25 |
26 | override fun getItem(pos: Int): Fragment =
27 | ButtonStyleFragment.newInstance(pos)
28 |
29 | override fun getCount(): Int = 3
30 |
31 | override fun getPageTitle(pos: Int): CharSequence? =
32 | ButtonStyleFragment.getTitle(pos)
33 |
34 | }
35 | return rootView
36 | }
37 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/zomato/sushiapp/fragments/images/ImagesMainFragment.kt:
--------------------------------------------------------------------------------
1 | package com.zomato.sushiapp.fragments.images
2 |
3 |
4 | import android.os.Bundle
5 | import android.view.LayoutInflater
6 | import android.view.View
7 | import android.view.ViewGroup
8 | import androidx.fragment.app.Fragment
9 | import com.zomato.sushiapp.R
10 |
11 | /**
12 | * A simple [Fragment] subclass.
13 | *
14 | */
15 | class ImagesMainFragment : Fragment() {
16 |
17 | override fun onCreateView(
18 | inflater: LayoutInflater, container: ViewGroup?,
19 | savedInstanceState: Bundle?
20 | ): View? {
21 | // Inflate the layout for this fragment
22 | val rootView = inflater.inflate(R.layout.fragment_image_views, container, false)
23 |
24 | return rootView
25 | }
26 |
27 |
28 | }
29 |
--------------------------------------------------------------------------------
/app/src/main/java/com/zomato/sushiapp/fragments/typography/TypographyMainFragment.kt:
--------------------------------------------------------------------------------
1 | package com.zomato.sushiapp.fragments.typography
2 |
3 |
4 | import android.os.Bundle
5 | import android.view.LayoutInflater
6 | import android.view.View
7 | import android.view.ViewGroup
8 | import androidx.fragment.app.Fragment
9 | import androidx.fragment.app.FragmentPagerAdapter
10 | import com.zomato.sushiapp.R
11 | import kotlinx.android.synthetic.main.fragment_typography.view.*
12 |
13 | /**
14 | * A simple [Fragment] subclass.
15 | *
16 | */
17 | class TypographyMainFragment : Fragment() {
18 |
19 | override fun onCreateView(
20 | inflater: LayoutInflater, container: ViewGroup?,
21 | savedInstanceState: Bundle?
22 | ): View? {
23 | // Inflate the layout for this fragment
24 | val rootView = inflater.inflate(R.layout.fragment_typography, container, false)
25 |
26 | rootView.viewpager_font_weight.adapter = object : FragmentPagerAdapter(childFragmentManager) {
27 | override fun getItem(pos: Int): Fragment =
28 | TypographyStyleFragment.newInstance(pos)
29 |
30 | override fun getCount(): Int = 7
31 |
32 | override fun getPageTitle(pos: Int): CharSequence? =
33 | TypographyStyleFragment.getTitle(pos)
34 |
35 | }
36 | return rootView
37 | }
38 |
39 |
40 | }
41 |
--------------------------------------------------------------------------------
/app/src/main/res/color/bottom_nav_item_color_selector.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable-hdpi/ic_topnav_bars.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Zomato/sushi-ui-android/3e976aa7b8b327826c3154b17b8c373987d0369a/app/src/main/res/drawable-hdpi/ic_topnav_bars.webp
--------------------------------------------------------------------------------
/app/src/main/res/drawable-hdpi/ic_topnav_buttons.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Zomato/sushi-ui-android/3e976aa7b8b327826c3154b17b8c373987d0369a/app/src/main/res/drawable-hdpi/ic_topnav_buttons.webp
--------------------------------------------------------------------------------
/app/src/main/res/drawable-hdpi/ic_topnav_colors.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Zomato/sushi-ui-android/3e976aa7b8b327826c3154b17b8c373987d0369a/app/src/main/res/drawable-hdpi/ic_topnav_colors.webp
--------------------------------------------------------------------------------
/app/src/main/res/drawable-hdpi/ic_topnav_forms.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Zomato/sushi-ui-android/3e976aa7b8b327826c3154b17b8c373987d0369a/app/src/main/res/drawable-hdpi/ic_topnav_forms.webp
--------------------------------------------------------------------------------
/app/src/main/res/drawable-hdpi/ic_topnav_images.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Zomato/sushi-ui-android/3e976aa7b8b327826c3154b17b8c373987d0369a/app/src/main/res/drawable-hdpi/ic_topnav_images.webp
--------------------------------------------------------------------------------
/app/src/main/res/drawable-hdpi/ic_topnav_snippets.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Zomato/sushi-ui-android/3e976aa7b8b327826c3154b17b8c373987d0369a/app/src/main/res/drawable-hdpi/ic_topnav_snippets.webp
--------------------------------------------------------------------------------
/app/src/main/res/drawable-hdpi/ic_topnav_star.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Zomato/sushi-ui-android/3e976aa7b8b327826c3154b17b8c373987d0369a/app/src/main/res/drawable-hdpi/ic_topnav_star.webp
--------------------------------------------------------------------------------
/app/src/main/res/drawable-hdpi/ic_topnav_typography.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Zomato/sushi-ui-android/3e976aa7b8b327826c3154b17b8c373987d0369a/app/src/main/res/drawable-hdpi/ic_topnav_typography.webp
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/bg_splash_image.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Zomato/sushi-ui-android/3e976aa7b8b327826c3154b17b8c373987d0369a/app/src/main/res/drawable-xhdpi/bg_splash_image.webp
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/ic_topnav_bars.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Zomato/sushi-ui-android/3e976aa7b8b327826c3154b17b8c373987d0369a/app/src/main/res/drawable-xhdpi/ic_topnav_bars.webp
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/ic_topnav_buttons.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Zomato/sushi-ui-android/3e976aa7b8b327826c3154b17b8c373987d0369a/app/src/main/res/drawable-xhdpi/ic_topnav_buttons.webp
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/ic_topnav_colors.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Zomato/sushi-ui-android/3e976aa7b8b327826c3154b17b8c373987d0369a/app/src/main/res/drawable-xhdpi/ic_topnav_colors.webp
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/ic_topnav_forms.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Zomato/sushi-ui-android/3e976aa7b8b327826c3154b17b8c373987d0369a/app/src/main/res/drawable-xhdpi/ic_topnav_forms.webp
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/ic_topnav_images.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Zomato/sushi-ui-android/3e976aa7b8b327826c3154b17b8c373987d0369a/app/src/main/res/drawable-xhdpi/ic_topnav_images.webp
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/ic_topnav_snippets.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Zomato/sushi-ui-android/3e976aa7b8b327826c3154b17b8c373987d0369a/app/src/main/res/drawable-xhdpi/ic_topnav_snippets.webp
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/ic_topnav_star.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Zomato/sushi-ui-android/3e976aa7b8b327826c3154b17b8c373987d0369a/app/src/main/res/drawable-xhdpi/ic_topnav_star.webp
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/ic_topnav_typography.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Zomato/sushi-ui-android/3e976aa7b8b327826c3154b17b8c373987d0369a/app/src/main/res/drawable-xhdpi/ic_topnav_typography.webp
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/sushi_cover_image.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Zomato/sushi-ui-android/3e976aa7b8b327826c3154b17b8c373987d0369a/app/src/main/res/drawable-xhdpi/sushi_cover_image.webp
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/text_splash.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Zomato/sushi-ui-android/3e976aa7b8b327826c3154b17b8c373987d0369a/app/src/main/res/drawable-xhdpi/text_splash.webp
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/bg_splash_image.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Zomato/sushi-ui-android/3e976aa7b8b327826c3154b17b8c373987d0369a/app/src/main/res/drawable-xxhdpi/bg_splash_image.webp
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/ic_topnav_bars.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Zomato/sushi-ui-android/3e976aa7b8b327826c3154b17b8c373987d0369a/app/src/main/res/drawable-xxhdpi/ic_topnav_bars.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/ic_topnav_buttons.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Zomato/sushi-ui-android/3e976aa7b8b327826c3154b17b8c373987d0369a/app/src/main/res/drawable-xxhdpi/ic_topnav_buttons.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/ic_topnav_colors.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Zomato/sushi-ui-android/3e976aa7b8b327826c3154b17b8c373987d0369a/app/src/main/res/drawable-xxhdpi/ic_topnav_colors.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/ic_topnav_forms.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Zomato/sushi-ui-android/3e976aa7b8b327826c3154b17b8c373987d0369a/app/src/main/res/drawable-xxhdpi/ic_topnav_forms.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/ic_topnav_images.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Zomato/sushi-ui-android/3e976aa7b8b327826c3154b17b8c373987d0369a/app/src/main/res/drawable-xxhdpi/ic_topnav_images.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/ic_topnav_snippets.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Zomato/sushi-ui-android/3e976aa7b8b327826c3154b17b8c373987d0369a/app/src/main/res/drawable-xxhdpi/ic_topnav_snippets.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/ic_topnav_star.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Zomato/sushi-ui-android/3e976aa7b8b327826c3154b17b8c373987d0369a/app/src/main/res/drawable-xxhdpi/ic_topnav_star.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/ic_topnav_typography.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Zomato/sushi-ui-android/3e976aa7b8b327826c3154b17b8c373987d0369a/app/src/main/res/drawable-xxhdpi/ic_topnav_typography.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/sushi_cover_image.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Zomato/sushi-ui-android/3e976aa7b8b327826c3154b17b8c373987d0369a/app/src/main/res/drawable-xxhdpi/sushi_cover_image.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/text_splash.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Zomato/sushi-ui-android/3e976aa7b8b327826c3154b17b8c373987d0369a/app/src/main/res/drawable-xxhdpi/text_splash.webp
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxxhdpi/bg_splash_image.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Zomato/sushi-ui-android/3e976aa7b8b327826c3154b17b8c373987d0369a/app/src/main/res/drawable-xxxhdpi/bg_splash_image.webp
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxxhdpi/ic_topnav_bars.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Zomato/sushi-ui-android/3e976aa7b8b327826c3154b17b8c373987d0369a/app/src/main/res/drawable-xxxhdpi/ic_topnav_bars.webp
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxxhdpi/ic_topnav_buttons.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Zomato/sushi-ui-android/3e976aa7b8b327826c3154b17b8c373987d0369a/app/src/main/res/drawable-xxxhdpi/ic_topnav_buttons.webp
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxxhdpi/ic_topnav_colors.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Zomato/sushi-ui-android/3e976aa7b8b327826c3154b17b8c373987d0369a/app/src/main/res/drawable-xxxhdpi/ic_topnav_colors.webp
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxxhdpi/ic_topnav_forms.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Zomato/sushi-ui-android/3e976aa7b8b327826c3154b17b8c373987d0369a/app/src/main/res/drawable-xxxhdpi/ic_topnav_forms.webp
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxxhdpi/ic_topnav_images.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Zomato/sushi-ui-android/3e976aa7b8b327826c3154b17b8c373987d0369a/app/src/main/res/drawable-xxxhdpi/ic_topnav_images.webp
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxxhdpi/ic_topnav_snippets.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Zomato/sushi-ui-android/3e976aa7b8b327826c3154b17b8c373987d0369a/app/src/main/res/drawable-xxxhdpi/ic_topnav_snippets.webp
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxxhdpi/ic_topnav_star.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Zomato/sushi-ui-android/3e976aa7b8b327826c3154b17b8c373987d0369a/app/src/main/res/drawable-xxxhdpi/ic_topnav_star.webp
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxxhdpi/ic_topnav_typography.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Zomato/sushi-ui-android/3e976aa7b8b327826c3154b17b8c373987d0369a/app/src/main/res/drawable-xxxhdpi/ic_topnav_typography.webp
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxxhdpi/sushi_cover_image.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Zomato/sushi-ui-android/3e976aa7b8b327826c3154b17b8c373987d0369a/app/src/main/res/drawable-xxxhdpi/sushi_cover_image.webp
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxxhdpi/text_splash.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Zomato/sushi-ui-android/3e976aa7b8b327826c3154b17b8c373987d0369a/app/src/main/res/drawable-xxxhdpi/text_splash.webp
--------------------------------------------------------------------------------
/app/src/main/res/drawable/bg_food.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Zomato/sushi-ui-android/3e976aa7b8b327826c3154b17b8c373987d0369a/app/src/main/res/drawable/bg_food.webp
--------------------------------------------------------------------------------
/app/src/main/res/drawable/bg_pattern1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Zomato/sushi-ui-android/3e976aa7b8b327826c3154b17b8c373987d0369a/app/src/main/res/drawable/bg_pattern1.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/bg_pattern2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Zomato/sushi-ui-android/3e976aa7b8b327826c3154b17b8c373987d0369a/app/src/main/res/drawable/bg_pattern2.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/bg_sample1.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | -
5 |
6 |
7 | -
8 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/bg_sample2.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | -
5 |
6 |
7 | -
8 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/bg_splash_screen.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | -
4 |
7 |
8 | -
9 |
12 |
13 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_buttons.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_circle_cross.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_color_palette.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_image_views.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_listings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_search.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_tags.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_text_fields.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_text_styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/logo_zomato.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | -
4 |
5 |
10 |
11 |
12 | -
19 |
20 |
21 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/side_nav_bar.xml:
--------------------------------------------------------------------------------
1 |
3 |
9 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/wordmark_zomato.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Zomato/sushi-ui-android/3e976aa7b8b327826c3154b17b8c373987d0369a/app/src/main/res/drawable/wordmark_zomato.png
--------------------------------------------------------------------------------
/app/src/main/res/font/okra.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
11 |
18 |
25 |
32 |
33 |
40 |
47 |
54 |
61 |
--------------------------------------------------------------------------------
/app/src/main/res/font/okra_bold.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Zomato/sushi-ui-android/3e976aa7b8b327826c3154b17b8c373987d0369a/app/src/main/res/font/okra_bold.ttf
--------------------------------------------------------------------------------
/app/src/main/res/font/okra_extrabold.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Zomato/sushi-ui-android/3e976aa7b8b327826c3154b17b8c373987d0369a/app/src/main/res/font/okra_extrabold.ttf
--------------------------------------------------------------------------------
/app/src/main/res/font/okra_extralight.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Zomato/sushi-ui-android/3e976aa7b8b327826c3154b17b8c373987d0369a/app/src/main/res/font/okra_extralight.ttf
--------------------------------------------------------------------------------
/app/src/main/res/font/okra_light.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Zomato/sushi-ui-android/3e976aa7b8b327826c3154b17b8c373987d0369a/app/src/main/res/font/okra_light.ttf
--------------------------------------------------------------------------------
/app/src/main/res/font/okra_medium.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Zomato/sushi-ui-android/3e976aa7b8b327826c3154b17b8c373987d0369a/app/src/main/res/font/okra_medium.ttf
--------------------------------------------------------------------------------
/app/src/main/res/font/okra_regular.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Zomato/sushi-ui-android/3e976aa7b8b327826c3154b17b8c373987d0369a/app/src/main/res/font/okra_regular.ttf
--------------------------------------------------------------------------------
/app/src/main/res/font/okra_semibold.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Zomato/sushi-ui-android/3e976aa7b8b327826c3154b17b8c373987d0369a/app/src/main/res/font/okra_semibold.ttf
--------------------------------------------------------------------------------
/app/src/main/res/font/okra_thin.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Zomato/sushi-ui-android/3e976aa7b8b327826c3154b17b8c373987d0369a/app/src/main/res/font/okra_thin.ttf
--------------------------------------------------------------------------------
/app/src/main/res/font/wasabi.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Zomato/sushi-ui-android/3e976aa7b8b327826c3154b17b8c373987d0369a/app/src/main/res/font/wasabi.ttf
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_component.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
11 |
12 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_demo_pull_collapsible.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
15 |
16 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/app_bar_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
13 |
14 |
20 |
21 |
22 |
23 |
24 |
25 |
32 |
33 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/content_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/fragment_buttons.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
12 |
13 |
17 |
18 |
23 |
24 |
29 |
30 |
35 |
36 |
37 |
38 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/fragment_card_stack.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
13 |
14 |
20 |
21 |
28 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/fragment_nav_components.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
12 |
13 |
17 |
18 |
22 |
23 |
27 |
28 |
32 |
33 |
37 |
38 |
42 |
43 |
44 |
45 |
53 |
54 |
55 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/fragment_typography.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
12 |
13 |
17 |
22 |
27 |
32 |
37 |
42 |
43 |
44 |
45 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/fragment_typography_style_bold.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
14 |
15 |
16 |
21 |
22 |
27 |
28 |
33 |
34 |
39 |
40 |
45 |
46 |
51 |
52 |
57 |
58 |
63 |
64 |
69 |
70 |
71 |
72 |
73 |
74 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/fragment_typography_style_light.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
14 |
15 |
16 |
21 |
22 |
27 |
28 |
33 |
34 |
39 |
40 |
45 |
46 |
51 |
52 |
57 |
58 |
63 |
64 |
69 |
70 |
71 |
72 |
73 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/fragment_typography_style_regular.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
13 |
14 |
15 |
19 |
20 |
25 |
26 |
30 |
31 |
35 |
36 |
40 |
41 |
45 |
46 |
50 |
51 |
55 |
56 |
60 |
61 |
62 |
63 |
64 |
65 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/layout_heading_large_tag.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
15 |
16 |
24 |
25 |
32 |
33 |
34 |
35 |
44 |
45 |
46 |
47 |
48 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/layout_seperator.xml:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/list_item_dummy_about.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
14 |
15 |
21 |
22 |
29 |
30 |
37 |
38 |
44 |
45 |
51 |
52 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/list_item_stackable_card.xml:
--------------------------------------------------------------------------------
1 |
2 |
12 |
13 |
23 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/nav_header_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
14 |
15 |
22 |
23 |
29 |
30 |
35 |
36 |
37 |
--------------------------------------------------------------------------------
/app/src/main/res/menu/activity_main_drawer.xml:
--------------------------------------------------------------------------------
1 |
2 |
51 |
--------------------------------------------------------------------------------
/app/src/main/res/menu/main.xml:
--------------------------------------------------------------------------------
1 |
2 |
13 |
--------------------------------------------------------------------------------
/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/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Zomato/sushi-ui-android/3e976aa7b8b327826c3154b17b8c373987d0369a/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher_background.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Zomato/sushi-ui-android/3e976aa7b8b327826c3154b17b8c373987d0369a/app/src/main/res/mipmap-hdpi/ic_launcher_background.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Zomato/sushi-ui-android/3e976aa7b8b327826c3154b17b8c373987d0369a/app/src/main/res/mipmap-hdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Zomato/sushi-ui-android/3e976aa7b8b327826c3154b17b8c373987d0369a/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher_background.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Zomato/sushi-ui-android/3e976aa7b8b327826c3154b17b8c373987d0369a/app/src/main/res/mipmap-mdpi/ic_launcher_background.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Zomato/sushi-ui-android/3e976aa7b8b327826c3154b17b8c373987d0369a/app/src/main/res/mipmap-mdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Zomato/sushi-ui-android/3e976aa7b8b327826c3154b17b8c373987d0369a/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher_background.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Zomato/sushi-ui-android/3e976aa7b8b327826c3154b17b8c373987d0369a/app/src/main/res/mipmap-xhdpi/ic_launcher_background.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Zomato/sushi-ui-android/3e976aa7b8b327826c3154b17b8c373987d0369a/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Zomato/sushi-ui-android/3e976aa7b8b327826c3154b17b8c373987d0369a/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher_background.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Zomato/sushi-ui-android/3e976aa7b8b327826c3154b17b8c373987d0369a/app/src/main/res/mipmap-xxhdpi/ic_launcher_background.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Zomato/sushi-ui-android/3e976aa7b8b327826c3154b17b8c373987d0369a/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Zomato/sushi-ui-android/3e976aa7b8b327826c3154b17b8c373987d0369a/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher_background.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Zomato/sushi-ui-android/3e976aa7b8b327826c3154b17b8c373987d0369a/app/src/main/res/mipmap-xxxhdpi/ic_launcher_background.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Zomato/sushi-ui-android/3e976aa7b8b327826c3154b17b8c373987d0369a/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/values-night/bools.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | false
4 |
--------------------------------------------------------------------------------
/app/src/main/res/values-night/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | @color/sushi_black
4 |
--------------------------------------------------------------------------------
/app/src/main/res/values-night/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | @string/icon_moon
4 |
--------------------------------------------------------------------------------
/app/src/main/res/values-v23/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
8 |
9 |
15 |
16 |
--------------------------------------------------------------------------------
/app/src/main/res/values/bools.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | true
4 |
--------------------------------------------------------------------------------
/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | @color/sushi_grey_100
4 |
5 |
--------------------------------------------------------------------------------
/app/src/main/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 16dp
4 | 16dp
5 | 8dp
6 | 176dp
7 | 16dp
8 |
--------------------------------------------------------------------------------
/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | Sushi Sampler
3 | Open navigation drawer
4 | Close navigation drawer
5 | Android Studio
6 | android.studio@android.com
7 | Navigation header
8 | Settings
9 |
10 | @string/icon_moon_empty
11 |
12 |
13 |
14 | Headline Text
15 | Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam gravida
16 |
17 | Sushi
18 | About
19 | Zomato
20 |
21 |
22 | Hello blank fragment
23 |
24 |
--------------------------------------------------------------------------------
/app/src/test/java/com/zomato/sushiapp/ExampleUnitTest.kt:
--------------------------------------------------------------------------------
1 | package com.zomato.sushiapp
2 |
3 | import org.junit.Assert.assertEquals
4 | import org.junit.Test
5 |
6 | /**
7 | * Example local unit test, which will execute on the development machine (host).
8 | *
9 | * See [testing documentation](http://d.android.com/tools/testing).
10 | */
11 | class ExampleUnitTest {
12 | @Test
13 | fun addition_isCorrect() {
14 | assertEquals(4, 2 + 2)
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/app/src/test/java/com/zomato/sushiapp/MainFragmentProviderTest.kt:
--------------------------------------------------------------------------------
1 | package com.zomato.sushiapp
2 |
3 | import android.text.TextUtils
4 | import org.junit.Test
5 | import org.junit.runner.RunWith
6 | import org.robolectric.Robolectric
7 | import org.robolectric.RobolectricTestRunner
8 | import org.robolectric.RuntimeEnvironment
9 |
10 | import org.junit.Assert.*
11 |
12 |
13 | /**
14 | * created by championswimmer on 2019-05-10
15 | * Copyright (c) 2019 Zomato Media Pvt. Ltd.
16 | */
17 | @RunWith(RobolectricTestRunner::class)
18 | class MainFragmentProviderTest {
19 |
20 | @JvmField
21 | var mainActivity = Robolectric.setupActivity(MainActivity::class.java)
22 |
23 | @JvmField
24 | var mainFragmentProvider = MainFragmentProvider(
25 | RuntimeEnvironment.application,
26 | mainActivity.supportFragmentManager
27 | )
28 |
29 |
30 | @Test
31 | fun `getCount returns 3`() {
32 | assertEquals(3, mainFragmentProvider.getCount())
33 | }
34 |
35 | @Test
36 | fun `getTitle zomato_at 1`() {
37 | assertEquals("Zomato", mainFragmentProvider.getTitle(1))
38 | }
39 |
40 | @Test
41 | fun `getTabData icons not empty`() {
42 | val tabData = mainFragmentProvider.getTabData(1)
43 | assertFalse(TextUtils.isEmpty(tabData.activeIcon))
44 | assertFalse(TextUtils.isEmpty(tabData.inactiveIcon))
45 |
46 | }
47 |
48 |
49 | }
--------------------------------------------------------------------------------
/build.gradle:
--------------------------------------------------------------------------------
1 | // Top-level build file where you can add configuration options common to all sub-projects/modules.
2 | buildscript {
3 | ext.kotlin_version = '1.4.0'
4 | ext.android_plugin_version = '7.0.3'
5 | ext.jacoco_version = '0.8.3'
6 |
7 | repositories {
8 | google()
9 | jcenter()
10 |
11 | }
12 | dependencies {
13 | classpath "com.android.tools.build:gradle:$android_plugin_version"
14 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
15 | classpath "org.jacoco:org.jacoco.core:$jacoco_version"
16 | // NOTE: Do not place your application dependencies here; they belong
17 | // in the individual module build.gradle files
18 | }
19 | }
20 |
21 | allprojects {
22 | repositories {
23 | google()
24 | jcenter()
25 |
26 | }
27 | }
28 | ext {
29 | def props = new Properties()
30 | file("version.properties").withInputStream { props.load(it) }
31 |
32 | compileSdkVersion = 30
33 | minSdkVersion = 21
34 | targetSdkVersion = 30
35 |
36 | materialVersion = '1.4.0'
37 | appCompatVersion = '1.3.1'
38 | constraintLayoutVersion = '2.1.2'
39 | viewPagerVersion = '1.0.0'
40 | fragmentVersion = '1.0.0'
41 |
42 | espressoVersion = '3.3.0'
43 | jUnitVersion = '4.13.1'
44 | robolectricVersion = '4.3'
45 | assertJVersion = '2.4.0'
46 | assertJAndroidVersion = '1.1.1'
47 | testRunnerVersion = '1.2.0'
48 | mockitoVersion = '2.19.0'
49 | assertJCoreVersion = '1.7.1'
50 |
51 | global_version_code = props.getProperty("VERSION_CODE").toInteger()
52 | global_version_name = props.get("VERSION_NAME")
53 | }
54 |
55 | task clean(type: Delete) {
56 | delete rootProject.buildDir
57 | }
58 | apply plugin: 'android-reporting'
--------------------------------------------------------------------------------
/design-assets/wasabi/Read Me.txt:
--------------------------------------------------------------------------------
1 | Open *demo.html* to see a list of all the glyphs in your font along with their codes/ligatures.
2 |
3 | To use the generated font in desktop programs, you can install the TTF font. In order to copy the character associated with each icon, refer to the text box at the bottom right corner of each glyph in demo.html. The character inside this text box may be invisible; but it can still be copied. See this guide for more info: https://icomoon.io/#docs/local-fonts
4 |
5 | You won't need any of the files located under the *demo-files* directory when including the generated font in your own projects.
6 |
7 | You can import *selection.json* back to the IcoMoon app using the *Import Icons* button (or via Main Menu → Manage Projects) to retrieve your icon selection.
8 |
--------------------------------------------------------------------------------
/design-assets/wasabi/demo-files/demo.css:
--------------------------------------------------------------------------------
1 | body {
2 | padding: 0;
3 | margin: 0;
4 | font-family: sans-serif;
5 | font-size: 1em;
6 | line-height: 1.5;
7 | color: #555;
8 | background: #fff;
9 | }
10 | h1 {
11 | font-size: 1.5em;
12 | font-weight: normal;
13 | }
14 | small {
15 | font-size: .66666667em;
16 | }
17 | a {
18 | color: #e74c3c;
19 | text-decoration: none;
20 | }
21 | a:hover, a:focus {
22 | box-shadow: 0 1px #e74c3c;
23 | }
24 | .bshadow0, input {
25 | box-shadow: inset 0 -2px #e7e7e7;
26 | }
27 | input:hover {
28 | box-shadow: inset 0 -2px #ccc;
29 | }
30 | input, fieldset {
31 | font-family: sans-serif;
32 | font-size: 1em;
33 | margin: 0;
34 | padding: 0;
35 | border: 0;
36 | }
37 | input {
38 | color: inherit;
39 | line-height: 1.5;
40 | height: 1.5em;
41 | padding: .25em 0;
42 | }
43 | input:focus {
44 | outline: none;
45 | box-shadow: inset 0 -2px #449fdb;
46 | }
47 | .glyph {
48 | font-size: 16px;
49 | width: 15em;
50 | padding-bottom: 1em;
51 | margin-right: 4em;
52 | margin-bottom: 1em;
53 | float: left;
54 | overflow: hidden;
55 | }
56 | .liga {
57 | width: 80%;
58 | width: calc(100% - 2.5em);
59 | }
60 | .talign-right {
61 | text-align: right;
62 | }
63 | .talign-center {
64 | text-align: center;
65 | }
66 | .bgc1 {
67 | background: #f1f1f1;
68 | }
69 | .fgc1 {
70 | color: #999;
71 | }
72 | .fgc0 {
73 | color: #000;
74 | }
75 | p {
76 | margin-top: 1em;
77 | margin-bottom: 1em;
78 | }
79 | .mvm {
80 | margin-top: .75em;
81 | margin-bottom: .75em;
82 | }
83 | .mtn {
84 | margin-top: 0;
85 | }
86 | .mtl, .mal {
87 | margin-top: 1.5em;
88 | }
89 | .mbl, .mal {
90 | margin-bottom: 1.5em;
91 | }
92 | .mal, .mhl {
93 | margin-left: 1.5em;
94 | margin-right: 1.5em;
95 | }
96 | .mhmm {
97 | margin-left: 1em;
98 | margin-right: 1em;
99 | }
100 | .mls {
101 | margin-left: .25em;
102 | }
103 | .ptl {
104 | padding-top: 1.5em;
105 | }
106 | .pbs, .pvs {
107 | padding-bottom: .25em;
108 | }
109 | .pvs, .pts {
110 | padding-top: .25em;
111 | }
112 | .unit {
113 | float: left;
114 | }
115 | .unitRight {
116 | float: right;
117 | }
118 | .size1of2 {
119 | width: 50%;
120 | }
121 | .size1of1 {
122 | width: 100%;
123 | }
124 | .clearfix:before, .clearfix:after {
125 | content: " ";
126 | display: table;
127 | }
128 | .clearfix:after {
129 | clear: both;
130 | }
131 | .hidden-true {
132 | display: none;
133 | }
134 | .textbox0 {
135 | width: 3em;
136 | background: #f1f1f1;
137 | padding: .25em .5em;
138 | line-height: 1.5;
139 | height: 1.5em;
140 | }
141 | #testDrive {
142 | display: block;
143 | padding-top: 24px;
144 | line-height: 1.5;
145 | }
146 | .fs0 {
147 | font-size: 16px;
148 | }
149 | .fs1 {
150 | font-size: 24px;
151 | }
152 |
153 |
--------------------------------------------------------------------------------
/design-assets/wasabi/demo-files/demo.js:
--------------------------------------------------------------------------------
1 | if (!('boxShadow' in document.body.style)) {
2 | document.body.setAttribute('class', 'noBoxShadow');
3 | }
4 |
5 | document.body.addEventListener("click", function(e) {
6 | var target = e.target;
7 | if (target.tagName === "INPUT" &&
8 | target.getAttribute('class').indexOf('liga') === -1) {
9 | target.select();
10 | }
11 | });
12 |
13 | (function() {
14 | var fontSize = document.getElementById('fontSize'),
15 | testDrive = document.getElementById('testDrive'),
16 | testText = document.getElementById('testText');
17 | function updateTest() {
18 | testDrive.innerHTML = testText.value || String.fromCharCode(160);
19 | if (window.icomoonLiga) {
20 | window.icomoonLiga(testDrive);
21 | }
22 | }
23 | function updateSize() {
24 | testDrive.style.fontSize = fontSize.value + 'px';
25 | }
26 | fontSize.addEventListener('change', updateSize, false);
27 | testText.addEventListener('input', updateTest, false);
28 | testText.addEventListener('change', updateTest, false);
29 | updateSize();
30 | }());
31 |
--------------------------------------------------------------------------------
/design-assets/wasabi/fonts/wasabi.eot:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Zomato/sushi-ui-android/3e976aa7b8b327826c3154b17b8c373987d0369a/design-assets/wasabi/fonts/wasabi.eot
--------------------------------------------------------------------------------
/design-assets/wasabi/fonts/wasabi.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Zomato/sushi-ui-android/3e976aa7b8b327826c3154b17b8c373987d0369a/design-assets/wasabi/fonts/wasabi.ttf
--------------------------------------------------------------------------------
/design-assets/wasabi/fonts/wasabi.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Zomato/sushi-ui-android/3e976aa7b8b327826c3154b17b8c373987d0369a/design-assets/wasabi/fonts/wasabi.woff
--------------------------------------------------------------------------------
/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=-Xmx4000m -Xms2000m
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 | # Kotlin code style for this project: "official" or "obsolete":
15 | kotlin.code.style=official
16 | android.useAndroidX=true
17 | android.enableJetifier=true
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Zomato/sushi-ui-android/3e976aa7b8b327826c3154b17b8c373987d0369a/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Mon Mar 25 00:00:05 IST 2019
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-7.0.2-all.zip
7 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/jacoco.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'jacoco'
2 |
3 | jacoco {
4 | toolVersion = "$jacoco_version"
5 | }
6 |
7 | tasks.withType(Test) {
8 | jacoco.includeNoLocationClasses = true
9 | }
10 |
11 | task jacocoTestReport(type: JacocoReport, dependsOn: ['testDebugUnitTest', 'createDebugCoverageReport']) {
12 |
13 | group "Reporting"
14 | description "Generate Jacoco coverage reports."
15 |
16 | reports {
17 | xml.enabled = true
18 | html.enabled = true
19 | html.destination file("${rootProject.buildDir}/coverage-report")
20 | }
21 |
22 | def javaClasses = []
23 | def kotlinClasses = []
24 | def javaSrc = []
25 | def kotlinSrc = []
26 | def execution = []
27 |
28 | def fileFilter = ['**/R.class', '**/R$*.class', '**/BuildConfig.*', '**/Manifest*.*', '**/*Test*.*', 'android/**/*.*']
29 |
30 | rootProject.subprojects.each { proj ->
31 | javaClasses << fileTree(dir: "$proj.buildDir/intermediates/javac/debug", excludes: fileFilter)
32 | kotlinClasses << fileTree(dir: "$proj.buildDir/tmp/kotlin-classes/debug", excludes: fileFilter)
33 | javaSrc << "$proj.projectDir/src/main/java"
34 | kotlinSrc << "$proj.projectDir/src/main/kotlin"
35 | execution << fileTree(dir: proj.buildDir,
36 | includes: ['jacoco/testDebugUnitTest.exec',
37 | 'outputs/code_coverage/debugAndroidTest/connected/**/*.ec'])
38 | }
39 |
40 | getSourceDirectories().setFrom(javaSrc, kotlinSrc)
41 | getClassDirectories().setFrom(javaClasses, kotlinClasses)
42 |
43 | getExecutionData().setFrom(execution)
44 |
45 | doLast() {
46 | print execution
47 | print "file://${reports.html.destination}/index.html"
48 | }
49 | }
--------------------------------------------------------------------------------
/localPublish.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | ./gradlew sushilib:assembleRelease
4 | ./gradlew sushilib:publishReleaseAarPublicationToMavenLocal
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app', ':sushilib'
2 |
--------------------------------------------------------------------------------
/sushilib/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/sushilib/build.gradle:
--------------------------------------------------------------------------------
1 | def rootConfiguration = rootProject.ext
2 |
3 | def tryApplyFrom(libName) {
4 | try {
5 | apply from: libName
6 | } catch (e) {
7 | println("Could not load publishing configuration")
8 | e.printStackTrace()
9 | }
10 | }
11 |
12 | // Maven Publishing Details
13 | ext.libraryGroupId = 'com.zomato.sushilib'
14 | ext.libraryArtifactId = 'sushi-ui-android'
15 |
16 | apply plugin: 'com.android.library'
17 | apply plugin: 'kotlin-android'
18 | apply plugin: 'kotlin-android-extensions'
19 | tryApplyFrom "../jacoco.gradle"
20 |
21 | android {
22 | compileSdkVersion rootConfiguration.compileSdkVersion
23 |
24 | defaultConfig {
25 | minSdkVersion rootConfiguration.minSdkVersion
26 | targetSdkVersion rootConfiguration.targetSdkVersion
27 | versionCode rootConfiguration.global_version_code
28 | versionName rootConfiguration.global_version_name
29 |
30 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
31 | vectorDrawables.useSupportLibrary = true
32 | }
33 |
34 | buildTypes {
35 | release {
36 | minifyEnabled false
37 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
38 | consumerProguardFiles 'proguard-consumer-rules.pro'
39 | }
40 | debug {
41 | testCoverageEnabled true
42 | }
43 | external {
44 | // Copy all configuration from release buildType.
45 | initWith release
46 | minifyEnabled true
47 | }
48 | }
49 |
50 | compileOptions {
51 | sourceCompatibility JavaVersion.VERSION_1_8
52 | targetCompatibility JavaVersion.VERSION_1_8
53 | }
54 |
55 | testOptions {
56 | execution 'ANDROIDX_TEST_ORCHESTRATOR'
57 | // Animations slow down test startup time
58 | animationsDisabled true
59 | unitTests {
60 | returnDefaultValues = true
61 | includeAndroidResources = true
62 | }
63 | }
64 |
65 | lintOptions{
66 | baseline file ('lint-baseline.xml')
67 | }
68 | }
69 |
70 | dependencies {
71 | implementation fileTree(include: ['*.jar'], dir: 'libs')
72 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
73 | implementation "androidx.appcompat:appcompat:${rootConfiguration.appCompatVersion}"
74 | implementation "com.google.android.material:material:${rootConfiguration.materialVersion}"
75 |
76 | testImplementation "junit:junit:${rootConfiguration.jUnitVersion}"
77 | testImplementation "org.mockito:mockito-core:${rootConfiguration.mockitoVersion}"
78 | testImplementation "org.robolectric:robolectric:${rootConfiguration.robolectricVersion}"
79 |
80 | androidTestUtil "androidx.test:orchestrator:1.1.0"
81 | androidTestImplementation "androidx.test:rules:${rootConfiguration.testRunnerVersion}"
82 | androidTestImplementation "androidx.test:runner:${rootConfiguration.testRunnerVersion}"
83 | androidTestImplementation "androidx.test.espresso:espresso-core:${rootConfiguration.espressoVersion}"
84 | }
85 | repositories {
86 | mavenCentral()
87 | }
88 |
89 | tryApplyFrom "./publish.gradle"
--------------------------------------------------------------------------------
/sushilib/proguard-consumer-rules.pro:
--------------------------------------------------------------------------------
1 |
2 | # Because we perform reflection into menus
3 | -keep class androidx.appcompat.view.menu.** {*;}
--------------------------------------------------------------------------------
/sushilib/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
22 | -repackageclasses com.zomato.sushilib # will move obscufated classes to package dir rather than root dir
23 | -keep class com.zomato.sushilib.atoms.** { public *; }
24 | -keep class com.zomato.sushilib.molecules.** { public *; }
25 | -keep class com.zomato.sushilib.annotations.** { public *; }
26 | -keep class com.zomato.sushilib.utils.** { public *; }
27 | -keep class com.zomato.sushilib.BuildConfig { public *; }
--------------------------------------------------------------------------------
/sushilib/src/androidTest/java/com/zomato/sushilib/ExampleInstrumentedTest.java:
--------------------------------------------------------------------------------
1 | package com.zomato.sushilib;
2 |
3 | import android.content.Context;
4 | import androidx.test.InstrumentationRegistry;
5 | import androidx.test.runner.AndroidJUnit4;
6 |
7 | import org.junit.Test;
8 | import org.junit.runner.RunWith;
9 |
10 | import static org.junit.Assert.*;
11 |
12 | /**
13 | * Instrumented test, which will execute on an Android device.
14 | *
15 | * @see Testing documentation
16 | */
17 | @RunWith(AndroidJUnit4.class)
18 | public class ExampleInstrumentedTest {
19 | @Test
20 | public void useAppContext() {
21 | // Context of the app under test.
22 | Context appContext = InstrumentationRegistry.getTargetContext();
23 |
24 | assertEquals("com.zomato.sushilib.test", appContext.getPackageName());
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/sushilib/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
--------------------------------------------------------------------------------
/sushilib/src/main/java/com/zomato/sushilib/annotations/ButtonDimension.java:
--------------------------------------------------------------------------------
1 | package com.zomato.sushilib.annotations;
2 |
3 | import androidx.annotation.IntDef;
4 |
5 | import java.lang.annotation.Retention;
6 | import java.lang.annotation.RetentionPolicy;
7 |
8 | import static com.zomato.sushilib.annotations.ButtonDimension.*;
9 |
10 | /**
11 | * created by championswimmer on 19/04/19
12 | * Copyright (c) 2019 Zomato Media Pvt. Ltd.
13 | */
14 | @Retention(RetentionPolicy.SOURCE)
15 | @IntDef({LARGE, MEDIUM, SMALL})
16 | public @interface ButtonDimension {
17 | int LARGE = 0;
18 | int MEDIUM = 1;
19 | int SMALL = 2;
20 | }
21 |
--------------------------------------------------------------------------------
/sushilib/src/main/java/com/zomato/sushilib/annotations/ButtonType.java:
--------------------------------------------------------------------------------
1 | package com.zomato.sushilib.annotations;
2 |
3 | import androidx.annotation.IntDef;
4 |
5 | import java.lang.annotation.Retention;
6 | import java.lang.annotation.RetentionPolicy;
7 |
8 | import static com.zomato.sushilib.annotations.ButtonType.*;
9 |
10 | /**
11 | * created by championswimmer on 19/04/19
12 | * Copyright (c) 2019 Zomato Media Pvt. Ltd.
13 | */
14 | @Retention(RetentionPolicy.SOURCE)
15 | @IntDef({SOLID, OUTLINE, TEXT})
16 | public @interface ButtonType {
17 | int SOLID = 0;
18 | int OUTLINE = 1;
19 | int TEXT = 2;
20 | }
21 |
--------------------------------------------------------------------------------
/sushilib/src/main/java/com/zomato/sushilib/annotations/CheckableSelectorType.java:
--------------------------------------------------------------------------------
1 | package com.zomato.sushilib.annotations;
2 |
3 | import androidx.annotation.IntDef;
4 |
5 | import java.lang.annotation.Retention;
6 | import java.lang.annotation.RetentionPolicy;
7 |
8 | /**
9 | * Created by prempal on 2019-05-21.
10 | */
11 | @Retention(RetentionPolicy.SOURCE)
12 | @IntDef({CheckableSelectorType.RADIO, CheckableSelectorType.CHECKBOX})
13 | public @interface CheckableSelectorType {
14 | int RADIO = 0;
15 | int CHECKBOX = 1;
16 | }
17 |
--------------------------------------------------------------------------------
/sushilib/src/main/java/com/zomato/sushilib/annotations/ColorName.java:
--------------------------------------------------------------------------------
1 | package com.zomato.sushilib.annotations;
2 |
3 | import androidx.annotation.StringDef;
4 |
5 | import java.lang.annotation.Retention;
6 | import java.lang.annotation.RetentionPolicy;
7 |
8 | import static com.zomato.sushilib.annotations.ColorName.*;
9 |
10 | /**
11 | * created by championswimmer on 2019-05-09
12 | * Copyright (c) 2019 Zomato Media Pvt. Ltd.
13 | */
14 | @Retention(RetentionPolicy.SOURCE)
15 | @StringDef({
16 | BLACK, WHITE,
17 | RED, GREEN, BLUE, GREY, YELLOW, PURPLE,
18 | INDIGO, TEAL, ORANGE, BROWN, PINK
19 | })
20 | public @interface ColorName {
21 | // Constant Colors
22 | String BLACK = "black";
23 | String WHITE = "white";
24 |
25 | // Primary Colors
26 | String RED = "red";
27 | String GREEN = "green";
28 | String BLUE = "blue";
29 | String GREY = "grey";
30 | String YELLOW = "yellow";
31 | String PURPLE = "purple";
32 | String LIME = "lime";
33 |
34 | // Secondary Colors
35 | String INDIGO = "indigo";
36 | String CIDER = "cider";
37 | String TEAL = "teal";
38 | String ORANGE = "orange";
39 | String BROWN = "brown";
40 | String PINK = "pink";
41 | }
42 |
--------------------------------------------------------------------------------
/sushilib/src/main/java/com/zomato/sushilib/annotations/ColorTint.java:
--------------------------------------------------------------------------------
1 | package com.zomato.sushilib.annotations;
2 |
3 | import androidx.annotation.IntDef;
4 |
5 | import java.lang.annotation.Retention;
6 | import java.lang.annotation.RetentionPolicy;
7 |
8 | /**
9 | * created by championswimmer on 2019-05-09
10 | * Copyright (c) 2019 Zomato Media Pvt. Ltd.
11 | */
12 | @Retention(RetentionPolicy.SOURCE)
13 | @IntDef({100, 200, 300, 400, 500, 600, 700, 800, 900})
14 | public @interface ColorTint {
15 | }
16 |
--------------------------------------------------------------------------------
/sushilib/src/main/java/com/zomato/sushilib/annotations/FontWeight.java:
--------------------------------------------------------------------------------
1 | package com.zomato.sushilib.annotations;
2 |
3 | import androidx.annotation.IntDef;
4 |
5 | import java.lang.annotation.Retention;
6 | import java.lang.annotation.RetentionPolicy;
7 |
8 | import static com.zomato.sushilib.annotations.FontWeight.*;
9 |
10 | /**
11 | * created by championswimmer on 19/04/19
12 | * Copyright (c) 2019 Zomato Media Pvt. Ltd.
13 | */
14 | @Retention(RetentionPolicy.SOURCE)
15 | @IntDef({THIN, EXTRALIGHT, LIGHT, REGULAR, MEDIUM, SEMIBOLD, BOLD, EXTRABOLD})
16 | public @interface FontWeight {
17 | int THIN = 100;
18 | int EXTRALIGHT = 200;
19 | int LIGHT = 300;
20 | int REGULAR = 400;
21 | int MEDIUM = 500;
22 | int SEMIBOLD = 600;
23 | int BOLD = 700;
24 | int EXTRABOLD = 800;
25 | }
26 |
--------------------------------------------------------------------------------
/sushilib/src/main/java/com/zomato/sushilib/annotations/OutlineType.java:
--------------------------------------------------------------------------------
1 | package com.zomato.sushilib.annotations;
2 |
3 | import androidx.annotation.IntDef;
4 |
5 | import java.lang.annotation.Retention;
6 | import java.lang.annotation.RetentionPolicy;
7 |
8 | /**
9 | * created by championswimmer on 26/03/19
10 | * Copyright (c) 2019 Zomato Media Pvt. Ltd.
11 | */
12 | @Retention(RetentionPolicy.SOURCE)
13 | @IntDef({OutlineType.CIRCLE, OutlineType.ROUNDED_RECT})
14 | public @interface OutlineType {
15 | int CIRCLE = 0;
16 | int ROUNDED_RECT = 1;
17 | }
18 |
--------------------------------------------------------------------------------
/sushilib/src/main/java/com/zomato/sushilib/annotations/TagSize.java:
--------------------------------------------------------------------------------
1 | package com.zomato.sushilib.annotations;
2 |
3 | import androidx.annotation.IntDef;
4 |
5 | import java.lang.annotation.Retention;
6 | import java.lang.annotation.RetentionPolicy;
7 |
8 | import static com.zomato.sushilib.annotations.TagSize.*;
9 |
10 | /**
11 | * created by championswimmer on 19/04/19
12 | * Copyright (c) 2019 Zomato Media Pvt. Ltd.
13 | */
14 | @Retention(RetentionPolicy.SOURCE)
15 | @IntDef({LARGE, MEDIUM, SMALL, TINY, NANO})
16 | public @interface TagSize {
17 | int LARGE = 0;
18 | int MEDIUM = 1;
19 | int SMALL = 2;
20 | int TINY = 3;
21 | int NANO = 4;
22 | }
23 |
--------------------------------------------------------------------------------
/sushilib/src/main/java/com/zomato/sushilib/annotations/TagType.java:
--------------------------------------------------------------------------------
1 | package com.zomato.sushilib.annotations;
2 |
3 | import androidx.annotation.IntDef;
4 |
5 | import java.lang.annotation.Retention;
6 | import java.lang.annotation.RetentionPolicy;
7 |
8 | import static com.zomato.sushilib.annotations.TagType.*;
9 |
10 | /**
11 | * created by championswimmer on 19/04/19
12 | * Copyright (c) 2019 Zomato Media Pvt. Ltd.
13 | */
14 | @Retention(RetentionPolicy.SOURCE)
15 | @IntDef({ROUNDED, CAPSULE, ROUNDED_OUTLINE, CAPSULE_OUTLINE, ROUNDED_DASHED, CAPSULE_DASHED})
16 | public @interface TagType {
17 | int ROUNDED = 0;
18 | int CAPSULE = 1;
19 | int ROUNDED_OUTLINE = 2;
20 | int CAPSULE_OUTLINE = 3;
21 | int ROUNDED_DASHED = 4;
22 | int CAPSULE_DASHED = 5;
23 | }
24 |
--------------------------------------------------------------------------------
/sushilib/src/main/java/com/zomato/sushilib/annotations/TextViewOrientation.java:
--------------------------------------------------------------------------------
1 | package com.zomato.sushilib.annotations;
2 |
3 | import androidx.annotation.IntDef;
4 |
5 | import java.lang.annotation.Retention;
6 | import java.lang.annotation.RetentionPolicy;
7 |
8 | /**
9 | * Created by prempal on 2019-05-21.
10 | */
11 | @Retention(RetentionPolicy.SOURCE)
12 | @IntDef({TextViewOrientation.HORIZONTAL, TextViewOrientation.VERTICAL})
13 | public @interface TextViewOrientation {
14 | int HORIZONTAL = 0;
15 | int VERTICAL = 1;
16 | }
17 |
--------------------------------------------------------------------------------
/sushilib/src/main/java/com/zomato/sushilib/atoms/imageviews/SushiCircleImageView.kt:
--------------------------------------------------------------------------------
1 | package com.zomato.sushilib.atoms.imageviews
2 |
3 | import android.content.Context
4 | import android.graphics.Canvas
5 | import android.graphics.Color
6 | import android.graphics.Paint
7 | import android.util.AttributeSet
8 | import android.widget.ImageView.ScaleType.CENTER_CROP
9 | import androidx.annotation.AttrRes
10 | import androidx.annotation.StyleRes
11 | import androidx.appcompat.widget.AppCompatImageView
12 | import com.zomato.sushilib.R
13 | import com.zomato.sushilib.annotations.OutlineType
14 | import com.zomato.sushilib.utils.theme.ResourceThemeResolver.getThemeWrappedContext
15 | import com.zomato.sushilib.utils.view.SushiViewOutlineProvider
16 |
17 |
18 | /**
19 | * created by championswimmer on 28/03/19
20 | * Copyright (c) 2019 Zomato Media Pvt. Ltd.
21 | */
22 | open class SushiCircleImageView @JvmOverloads constructor(
23 | ctx: Context, attrs: AttributeSet? = null,
24 | @AttrRes defStyleAttr: Int = 0, @StyleRes defStyleRes: Int = 0
25 | ) : AppCompatImageView(
26 | getThemeWrappedContext(ctx, defStyleRes),
27 | attrs, defStyleAttr
28 | ) {
29 | private val mPreviewPaint = Paint().apply {
30 | this.style = Paint.Style.FILL
31 | this.isAntiAlias = true
32 | this.color = Color.DKGRAY
33 | }
34 |
35 | init {
36 | context.theme.obtainStyledAttributes(
37 | attrs, R.styleable.SushiCircleImageView, defStyleAttr, defStyleRes
38 | ).let {
39 | if (it.getInt(R.styleable.SushiCircleImageView_android_scaleType, -1) == -1) {
40 | // If not set, default to CENTER_CROP
41 | scaleType = CENTER_CROP
42 | }
43 |
44 | it.recycle()
45 | }
46 | outlineProvider = SushiViewOutlineProvider(
47 | OutlineType.CIRCLE,
48 | paddingOutside = false
49 | )
50 | clipToOutline = true
51 |
52 | }
53 |
54 | override fun onDraw(canvas: Canvas?) {
55 | if (!isInEditMode) {
56 | // At run time just rely on the outline provider
57 | return super.onDraw(canvas)
58 | } else {
59 | // For previewing purpose draw a grey shape
60 | (outlineProvider as SushiViewOutlineProvider).let {
61 | canvas?.drawOval(
62 | it.left.toFloat(), it.top.toFloat(), it.right.toFloat(), it.bottom.toFloat(),
63 | mPreviewPaint
64 | )
65 | }
66 | }
67 | }
68 | }
--------------------------------------------------------------------------------
/sushilib/src/main/java/com/zomato/sushilib/atoms/menu/SushiMenuItem.kt:
--------------------------------------------------------------------------------
1 | package com.zomato.sushilib.atoms.menu
2 |
3 | import android.graphics.drawable.Drawable
4 |
5 | data class SushiMenuItem(
6 | val itemId: Int,
7 | val title: String,
8 | val drawableId: Int? = null,
9 | val drawable: Drawable? = null
10 | )
11 |
--------------------------------------------------------------------------------
/sushilib/src/main/java/com/zomato/sushilib/atoms/textviews/SushiAutoContrastTextView.kt:
--------------------------------------------------------------------------------
1 | package com.zomato.sushilib.atoms.textviews
2 |
3 | import android.content.Context
4 | import android.graphics.drawable.ColorDrawable
5 | import android.util.AttributeSet
6 | import androidx.annotation.AttrRes
7 | import androidx.annotation.StyleRes
8 | import com.zomato.sushilib.R
9 | import com.zomato.sushilib.utils.color.ColorContrastUtils
10 |
11 | /**
12 | * A Text view that uses white or black color depending on
13 | * the background color
14 | */
15 |
16 | open class SushiAutoContrastTextView @JvmOverloads constructor(
17 | ctx: Context, attrs: AttributeSet? = null,
18 | @AttrRes defStyleAttr: Int = 0, @StyleRes defStyleRes: Int = 0
19 | ) : SushiTextView(ctx, attrs, defStyleAttr, defStyleRes) {
20 |
21 |
22 | override fun onLayout(changed: Boolean, left: Int, top: Int, right: Int, bottom: Int) {
23 | super.onLayout(changed, left, top, right, bottom)
24 | // TODO: This should also react when background changes
25 | setAutoContrastColor()
26 | }
27 |
28 | private fun setAutoContrastColor() {
29 | if (background is ColorDrawable) {
30 | if (ColorContrastUtils.isDarkColor((background as ColorDrawable).color)) {
31 | setTextColor(resources.getColor(R.color.sushi_grey_100))
32 | } else {
33 | setTextColor(resources.getColor(R.color.sushi_black))
34 | }
35 | }
36 | }
37 | }
--------------------------------------------------------------------------------
/sushilib/src/main/java/com/zomato/sushilib/atoms/textviews/SushiIconTextView.kt:
--------------------------------------------------------------------------------
1 | package com.zomato.sushilib.atoms.textviews
2 |
3 | import android.content.Context
4 | import android.util.AttributeSet
5 | import androidx.annotation.AttrRes
6 | import androidx.annotation.StyleRes
7 | import androidx.appcompat.widget.AppCompatTextView
8 | import com.zomato.sushilib.R
9 | import com.zomato.sushilib.utils.theme.ResourceThemeResolver.getThemeWrappedContext
10 |
11 | open class SushiIconTextView @JvmOverloads constructor(
12 | ctx: Context, attrs: AttributeSet? = null,
13 | @AttrRes defStyleAttr: Int = R.attr.sushiIconAppearance, @StyleRes defStyleRes: Int = 0
14 | ) : AppCompatTextView(
15 | getThemeWrappedContext(ctx, defStyleRes),
16 | attrs, defStyleAttr
17 | )
--------------------------------------------------------------------------------
/sushilib/src/main/java/com/zomato/sushilib/atoms/textviews/SushiTextView.kt:
--------------------------------------------------------------------------------
1 | package com.zomato.sushilib.atoms.textviews
2 |
3 | import android.content.Context
4 | import android.content.res.ColorStateList
5 | import android.graphics.PorterDuff
6 | import android.os.Build
7 | import android.util.AttributeSet
8 | import androidx.annotation.AttrRes
9 | import androidx.annotation.StyleRes
10 | import androidx.appcompat.widget.AppCompatTextView
11 | import com.zomato.sushilib.R
12 | import com.zomato.sushilib.annotations.FontWeight
13 | import com.zomato.sushilib.utils.text.TextFormatUtils
14 | import com.zomato.sushilib.utils.theme.ResourceThemeResolver.getThemeWrappedContext
15 | import com.zomato.sushilib.utils.widgets.DrawableSetters
16 | import com.zomato.sushilib.utils.widgets.TextViewUtils
17 |
18 | open class SushiTextView @JvmOverloads constructor(
19 | ctx: Context, attrs: AttributeSet? = null,
20 | @AttrRes defStyleAttr: Int = 0,
21 | @StyleRes defStyleRes: Int = 0
22 | ) : AppCompatTextView(
23 | getThemeWrappedContext(ctx, defStyleRes),
24 | attrs, defStyleAttr
25 | ), DrawableSetters {
26 | @get:FontWeight @setparam:FontWeight
27 | var textFontWeight: Int = FontWeight.REGULAR
28 | set(value) {
29 | field = value
30 | setTextAppearance(TextFormatUtils.textFontWeightToTextAppearance(value))
31 | }
32 |
33 | init {
34 | context?.theme?.obtainStyledAttributes(
35 | attrs,
36 | R.styleable.SushiTextView,
37 | defStyleAttr,
38 | defStyleRes
39 | )?.let {
40 | val attrTextFontWeight = it.getInt(R.styleable.SushiTextView_textFontWeight, -1)
41 | // Only do this is someone has actually set this attr in xml
42 | if (attrTextFontWeight != -1) {
43 | textFontWeight = attrTextFontWeight
44 | }
45 | it.recycle()
46 | }
47 | TextViewUtils.apply {
48 | applyDrawables(
49 | attrs, defStyleAttr,
50 | currentTextColor,
51 | textSize.toInt()
52 | )
53 | }
54 | }
55 |
56 | override fun setTextAppearance(resId: Int) {
57 | @Suppress("DEPRECATION")
58 | super.setTextAppearance(context, resId)
59 | }
60 |
61 | fun setCompoundDrawableColor(color: Int) {
62 | compoundDrawables.forEach { d ->
63 | d?.setColorFilter(color, PorterDuff.Mode.SRC_IN)
64 | }
65 | compoundDrawablesRelative.forEach { d ->
66 | d?.setColorFilter(color, PorterDuff.Mode.SRC_IN)
67 | }
68 | }
69 |
70 | override fun setCompoundDrawableTintList(tintList: ColorStateList?) {
71 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
72 | super.setCompoundDrawableTintList(tintList)
73 | } else {
74 | compoundDrawables.forEach { d ->
75 | d?.setTintList(tintList)
76 | }
77 | compoundDrawablesRelative.forEach { d ->
78 | d?.setTintList(tintList)
79 | }
80 | }
81 | }
82 |
83 | }
--------------------------------------------------------------------------------
/sushilib/src/main/java/com/zomato/sushilib/atoms/views/RoundedView.kt:
--------------------------------------------------------------------------------
1 | package com.zomato.sushilib.atoms.views
2 |
3 | import android.view.ViewOutlineProvider
4 | import com.zomato.sushilib.annotations.OutlineType
5 | import com.zomato.sushilib.utils.view.SushiViewOutlineProvider
6 |
7 | /**
8 | * created by championswimmer on 05/04/19
9 | * Copyright (c) 2019 Zomato Media Pvt. Ltd.
10 | */
11 | interface RoundedView {
12 | fun getOutlineProvider(): ViewOutlineProvider
13 | fun setOutlineProvider(outlineProvider: ViewOutlineProvider)
14 | fun setClipToOutline(clipToOutline: Boolean)
15 | fun getClipToOutline(): Boolean
16 |
17 | var cornerRadius: Float
18 | get() = (getOutlineProvider() as? SushiViewOutlineProvider)?.cornerRadius ?: 0f
19 | set(cr) {
20 | // If getOutlineProvider() is a SushiViewOutlineProvider
21 | (getOutlineProvider() as? SushiViewOutlineProvider)?.apply {
22 | cornerRadius = cr
23 |
24 | // If getOutlineProvider() turned out null, or not SushiViewOutlineProvider
25 | } ?: setOutlineProvider(SushiViewOutlineProvider(OutlineType.ROUNDED_RECT, cr))
26 |
27 | setClipToOutline(true)
28 | }
29 | }
--------------------------------------------------------------------------------
/sushilib/src/main/java/com/zomato/sushilib/molecules/inputfields/SushiCheckBox.kt:
--------------------------------------------------------------------------------
1 | package com.zomato.sushilib.molecules.inputfields
2 |
3 | import android.content.Context
4 | import android.util.AttributeSet
5 | import androidx.annotation.AttrRes
6 | import androidx.annotation.ColorInt
7 | import androidx.appcompat.widget.AppCompatCheckBox
8 | import com.zomato.sushilib.R
9 | import com.zomato.sushilib.utils.widgets.CompoundButtonHelper
10 |
11 | open class SushiCheckBox @JvmOverloads constructor(
12 | ctx: Context, attrs: AttributeSet? = null,
13 | @AttrRes defStyleAttr: Int = R.attr.checkboxStyle
14 | ) : AppCompatCheckBox(ctx, attrs, defStyleAttr) {
15 |
16 | private val compoundButtonHelper = CompoundButtonHelper(this)
17 | private var checkChangeAllowedListener: CheckChangeAllowedListener? = null
18 |
19 | init {
20 | compoundButtonHelper.init(attrs, defStyleAttr)
21 | }
22 |
23 | fun setControlColor(@ColorInt color: Int) {
24 | compoundButtonHelper.setControlColor(color)
25 | }
26 |
27 | /**
28 | * Sets the listener that checks whether it is allowed for the checkbox to change checked state.
29 | *
30 | * @param listener The listener.
31 | */
32 | fun setCheckChangeAllowedListener(listener: CheckChangeAllowedListener?) {
33 | checkChangeAllowedListener = listener
34 | }
35 |
36 | /**
37 | * Sets the lambda to be called that checks whether it is allowed for the checkbox to change checked state.
38 | *
39 | * @param listener The lambda.
40 | */
41 | fun setCheckChangeAllowedListener(listener: (isChecked: Boolean) -> Boolean) {
42 | setCheckChangeAllowedListener(object : CheckChangeAllowedListener {
43 | override fun isCheckChangeAllowed(isChecked: Boolean): Boolean = listener(isChecked)
44 | })
45 | }
46 |
47 | override fun performClick(): Boolean {
48 | return if (checkChangeAllowedListener == null || checkChangeAllowedListener?.isCheckChangeAllowed(isChecked) == true) {
49 | super.performClick()
50 | } else {
51 | true
52 | }
53 | }
54 |
55 | /**
56 | * Interface definition for a callback that checks whether it is allowed for the checkbox to change checked state.
57 | */
58 | interface CheckChangeAllowedListener {
59 | /**
60 | * Checks whether it is allowed for the checkbox to change checked state.
61 | *
62 | * @param isChecked Current checked state of the checkbox
63 | * @return boolean whether it is allowed for the checkbox to change checked state
64 | */
65 | fun isCheckChangeAllowed(isChecked: Boolean): Boolean
66 | }
67 | }
--------------------------------------------------------------------------------
/sushilib/src/main/java/com/zomato/sushilib/molecules/inputfields/SushiRadioButton.kt:
--------------------------------------------------------------------------------
1 | package com.zomato.sushilib.molecules.inputfields
2 |
3 | import android.content.Context
4 | import android.util.AttributeSet
5 | import androidx.annotation.AttrRes
6 | import androidx.annotation.ColorInt
7 | import androidx.appcompat.widget.AppCompatRadioButton
8 | import com.zomato.sushilib.R
9 | import com.zomato.sushilib.utils.widgets.CompoundButtonHelper
10 |
11 | open class SushiRadioButton @JvmOverloads constructor(
12 | ctx: Context, attrs: AttributeSet? = null,
13 | @AttrRes defStyleAttr: Int = R.attr.radioButtonStyle
14 | ) : AppCompatRadioButton(ctx, attrs, defStyleAttr) {
15 |
16 | private val compoundButtonHelper = CompoundButtonHelper(this)
17 |
18 | init {
19 | compoundButtonHelper.init(attrs, defStyleAttr)
20 | }
21 |
22 | fun setControlColor(@ColorInt color: Int) {
23 | compoundButtonHelper.setControlColor(color)
24 | }
25 | }
--------------------------------------------------------------------------------
/sushilib/src/main/java/com/zomato/sushilib/molecules/inputfields/SushiSwitch.kt:
--------------------------------------------------------------------------------
1 | package com.zomato.sushilib.molecules.inputfields
2 |
3 | import android.content.Context
4 | import android.content.res.ColorStateList
5 | import android.util.AttributeSet
6 | import androidx.annotation.AttrRes
7 | import androidx.annotation.ColorInt
8 | import androidx.annotation.StyleRes
9 | import androidx.appcompat.widget.SwitchCompat
10 | import androidx.core.content.ContextCompat
11 | import androidx.core.graphics.ColorUtils
12 | import com.zomato.sushilib.R
13 | import com.zomato.sushilib.utils.theme.ResourceThemeResolver
14 |
15 | /**
16 | * created by championswimmer on 01/05/19
17 | * Copyright (c) 2019 Zomato Media Pvt. Ltd.
18 | */
19 | open class SushiSwitch @JvmOverloads constructor(
20 | ctx: Context, attrs: AttributeSet? = null,
21 | @AttrRes defStyleAttr: Int = R.attr.switchStyle, @StyleRes defStyleRes: Int = 0
22 | ) : SwitchCompat(ctx, attrs, defStyleAttr) {
23 |
24 | @ColorInt
25 | private var color: Int = ResourceThemeResolver.getThemedColorFromAttr(context, android.R.attr.colorControlActivated)
26 |
27 | init {
28 | context.theme.obtainStyledAttributes(
29 | attrs,
30 | R.styleable.SushiSwitch,
31 | defStyleAttr, defStyleRes
32 | ).let {
33 | color = it.getColor(R.styleable.SushiSwitch_controlColor, color)
34 | applyTints()
35 | it.recycle()
36 | }
37 | }
38 |
39 | fun setControlColor(@ColorInt color: Int) {
40 | if (this.color == color) return
41 | this.color = color
42 | applyTints()
43 | }
44 |
45 | private fun applyTints() {
46 | thumbTintList = createThumbTintList()
47 | trackTintList = createTrackTintList()
48 | }
49 |
50 | private fun createThumbTintList(): ColorStateList {
51 | return ColorStateList(
52 | arrayOf(
53 | intArrayOf(android.R.attr.state_checked),
54 | intArrayOf()
55 | ),
56 | intArrayOf(
57 | color,
58 | ContextCompat.getColor(context, R.color.sushi_grey_400)
59 | )
60 | )
61 | }
62 |
63 | private fun createTrackTintList(): ColorStateList {
64 | return ColorStateList(
65 | arrayOf(
66 | intArrayOf(android.R.attr.state_checked),
67 | intArrayOf()
68 | ),
69 | intArrayOf(
70 | // 30% alpha
71 | ColorUtils.setAlphaComponent(color, 77),
72 | ColorUtils.setAlphaComponent(ContextCompat.getColor(context, R.color.sushi_grey_400), 77)
73 | )
74 | )
75 | }
76 |
77 | }
78 |
--------------------------------------------------------------------------------
/sushilib/src/main/java/com/zomato/sushilib/molecules/listings/SushiLabeledStrip.kt:
--------------------------------------------------------------------------------
1 | package com.zomato.sushilib.molecules.listings
2 |
3 | import android.content.Context
4 | import android.text.TextUtils
5 | import android.util.AttributeSet
6 | import android.widget.LinearLayout
7 | import androidx.annotation.AttrRes
8 | import androidx.annotation.StyleRes
9 | import com.zomato.sushilib.R
10 | import com.zomato.sushilib.atoms.textviews.SushiTextView
11 |
12 |
13 | /**
14 | * Created by prempal on 2019-04-29.
15 | */
16 | open class SushiLabeledStrip @JvmOverloads constructor(
17 | context: Context, attrs: AttributeSet? = null,
18 | @AttrRes defStyleAttr: Int = 0,
19 | @StyleRes defStyleRes: Int = 0
20 | ) : LinearLayout(context, attrs, defStyleAttr) {
21 |
22 | private var initialized = false
23 |
24 | private var labelTextView: SushiTextView? = null
25 | private var textView: SushiTextView? = null
26 |
27 | var text: String?
28 | get() = textView?.text?.toString()
29 | set(value) {
30 | if (TextUtils.isEmpty(value)) {
31 | textView = null
32 | } else {
33 | textView = (textView ?: SushiTextView(context).apply { text = value })
34 | }
35 | relayout()
36 | }
37 |
38 | var labelText: String?
39 | get() = labelTextView?.text?.toString()
40 | set(value) {
41 | if (TextUtils.isEmpty(value)) {
42 | labelTextView = null
43 | } else {
44 | labelTextView = (labelTextView ?: SushiTextView(context).apply {
45 | text = value
46 | setTextAppearance(R.style.TextAppearance_Sushi_Label)
47 | })
48 | }
49 | relayout()
50 | }
51 |
52 | init {
53 | orientation = LinearLayout.HORIZONTAL
54 |
55 | context.theme.obtainStyledAttributes(
56 | attrs,
57 | com.zomato.sushilib.R.styleable.SushiLabeledStrip,
58 | defStyleAttr,
59 | defStyleRes
60 | ).let {
61 | text = it.getString(R.styleable.SushiLabeledStrip_text)
62 | labelText = it.getString(R.styleable.SushiLabeledStrip_labelText)
63 | it.recycle()
64 |
65 | initialized = true
66 | relayout()
67 | }
68 | }
69 |
70 | private fun relayout() {
71 | if (!initialized) return
72 |
73 | removeAllViews()
74 | textView?.let {
75 | addView(textView, LinearLayout.LayoutParams(0, LinearLayout.LayoutParams.WRAP_CONTENT, 1.0f))
76 | }
77 | labelTextView?.let {
78 | addView(labelTextView)
79 | }
80 | }
81 | }
--------------------------------------------------------------------------------
/sushilib/src/main/java/com/zomato/sushilib/molecules/tags/SushiCircleIconView.kt:
--------------------------------------------------------------------------------
1 | package com.zomato.sushilib.molecules.tags
2 |
3 | import android.content.Context
4 | import android.content.res.ColorStateList
5 | import android.graphics.Color
6 | import android.graphics.drawable.GradientDrawable
7 | import android.util.AttributeSet
8 | import androidx.annotation.AttrRes
9 | import androidx.core.content.ContextCompat
10 | import com.zomato.sushilib.R
11 | import com.zomato.sushilib.atoms.textviews.SushiIconTextView
12 |
13 |
14 | /**
15 | * Created by prempal on 2019-04-30.
16 | */
17 | open class SushiCircleIconView @JvmOverloads constructor(
18 | ctx: Context, attrs: AttributeSet? = null,
19 | @AttrRes defStyleAttr: Int = R.attr.circleIconTextStyle
20 | ) : SushiIconTextView(ctx, attrs, defStyleAttr) {
21 |
22 | init {
23 | background = ContextCompat.getDrawable(context, R.drawable.sushi_rounded_icon_bg)
24 | context.theme.obtainStyledAttributes(
25 | attrs,
26 | R.styleable.SushiCircleIconView,
27 | defStyleAttr,
28 | 0
29 | ).let {
30 | it.getColorStateList(R.styleable.SushiCircleIconView_strokeColor)?.let {
31 | setStrokeColor(it)
32 | } ?: setStrokeColor(
33 | ColorStateList.valueOf(
34 | it.getColor(
35 | R.styleable.SushiCircleIconView_strokeColor,
36 | ContextCompat.getColor(context, R.color.sushi_grey_200)
37 | )
38 | )
39 | )
40 | it.recycle()
41 | }
42 | }
43 |
44 | fun setStrokeColor(colorStateList: ColorStateList) {
45 | background.mutate()
46 | (background as GradientDrawable).setStroke(
47 | resources.getDimensionPixelSize(R.dimen.sushi_stoke_width_small),
48 | colorStateList
49 | )
50 | (background as GradientDrawable).setColor(Color.TRANSPARENT)
51 | }
52 | }
--------------------------------------------------------------------------------
/sushilib/src/main/java/com/zomato/sushilib/organisms/navigation/SushiBottomNavigationView.kt:
--------------------------------------------------------------------------------
1 | package com.zomato.sushilib.organisms.navigation
2 |
3 | import android.content.Context
4 | import android.util.AttributeSet
5 | import android.view.Menu
6 | import androidx.annotation.IdRes
7 | import androidx.annotation.Size
8 | import com.google.android.material.bottomnavigation.BottomNavigationView
9 | import com.zomato.sushilib.R
10 | import com.zomato.sushilib.atoms.menu.SushiMenuItem
11 |
12 | open class SushiBottomNavigationView @JvmOverloads constructor(
13 | ctx: Context,
14 | attrs: AttributeSet? = null,
15 | defStyleAttr: Int = com.google.android.material.R.attr.bottomNavigationStyle
16 | ) : BottomNavigationView(ctx, attrs, defStyleAttr) {
17 |
18 | init {
19 | context.theme?.obtainStyledAttributes(
20 | attrs,
21 | R.styleable.SushiBottomNavigationView,
22 | defStyleAttr, 0
23 | )?.let {
24 | // Resetting this as we do not want to use the icon tint list that BottomNavigationView internally sets.
25 | itemIconTintList = it.getColorStateList(R.styleable.SushiBottomNavigationView_itemIconTint)
26 | it.recycle()
27 | }
28 | }
29 |
30 | /**
31 | * Sets up the navigation menu based on a supplied list of menu items.
32 | *
33 | * @param sushiMenuItems List of [SushiMenuItem]
34 | * @param defaultMenuItemIndex Index of default selected menu item. Default value is 0.
35 | */
36 | @Throws(IllegalArgumentException::class)
37 | fun setMenu(@Size(min = 1, max = 5) sushiMenuItems: List, defaultMenuItemIndex: Int = 0) {
38 | if (sushiMenuItems.size > 5) {
39 | throw IllegalArgumentException("Can't set more than 5 tabs")
40 | }
41 |
42 | for (item in sushiMenuItems) {
43 | this.menu.add(Menu.NONE, item.itemId, Menu.NONE, item.title).also {
44 | item.drawable?.run {
45 | it.icon = this
46 | } ?: item.drawableId?.run {
47 | it.setIcon(this)
48 | }
49 | }
50 | }
51 | setStartDestination(sushiMenuItems[defaultMenuItemIndex].itemId)
52 | }
53 |
54 | private fun setStartDestination(@IdRes startDestinationId: Int) {
55 | this.selectedItemId = startDestinationId
56 | }
57 | }
58 |
--------------------------------------------------------------------------------
/sushilib/src/main/java/com/zomato/sushilib/organisms/navigation/SushiTabLayout.kt:
--------------------------------------------------------------------------------
1 | package com.zomato.sushilib.organisms.navigation
2 |
3 | import android.content.Context
4 | import android.util.AttributeSet
5 | import androidx.annotation.AttrRes
6 | import androidx.annotation.StyleRes
7 | import com.google.android.material.tabs.TabLayout
8 | import com.zomato.sushilib.R
9 | import com.zomato.sushilib.utils.theme.ResourceThemeResolver.getThemeWrappedContext
10 |
11 | /**
12 | * created by championswimmer on 01/05/19
13 | * Copyright (c) 2019 Zomato Media Pvt. Ltd.
14 | */
15 | open class SushiTabLayout @JvmOverloads constructor(
16 | ctx: Context, attrs: AttributeSet? = null,
17 | @AttrRes defStyleAttr: Int = R.attr.tabStyle,
18 | @StyleRes defStyleRes: Int = 0
19 | ) : TabLayout(
20 | getThemeWrappedContext(ctx, defStyleRes),
21 | attrs, defStyleAttr
22 | )
--------------------------------------------------------------------------------
/sushilib/src/main/java/com/zomato/sushilib/organisms/stacks/AnimationConstants.kt:
--------------------------------------------------------------------------------
1 | package com.zomato.sushilib.organisms.stacks
2 |
3 | import android.view.animation.BounceInterpolator
4 | import android.view.animation.DecelerateInterpolator
5 | import android.view.animation.OvershootInterpolator
6 | import androidx.interpolator.view.animation.FastOutSlowInInterpolator
7 |
8 | /**
9 | * created by championswimmer on 2019-08-01
10 | * Copyright (c) 2019 Zomato Media Pvt. Ltd.
11 | */
12 | internal object AnimationConstants {
13 | const val DEFAULT_ANIM_DURATION = 350L
14 | val DEFAULT_BOUNCE_INTERPOLATOR = BounceInterpolator()
15 | val DEFAULT_OVERSHOOT_INTERPOLATOR = OvershootInterpolator()
16 | val DEFAULT_DECELERATE_INTERPOLATOR = DecelerateInterpolator()
17 | val DEFAULT_EASE_INTERPOLATOR = FastOutSlowInInterpolator()
18 | }
--------------------------------------------------------------------------------
/sushilib/src/main/java/com/zomato/sushilib/organisms/stacks/ExpandedItem.kt:
--------------------------------------------------------------------------------
1 | package com.zomato.sushilib.organisms.stacks
2 |
3 | import android.graphics.Rect
4 | import android.view.View
5 |
6 | /** Details of the currently expanded item. */
7 | data class ExpandedItem(
8 | // Original location of the currently expanded item (that is, when the user
9 | // selected this item). Can be used for restoring states after collapsing.
10 | val expandedItemLocationRect: Rect,
11 | val itemViewComingFrom: View?
12 | ) {
13 |
14 | internal fun isEmpty(): Boolean {
15 | return expandedItemLocationRect.width() == 0 && expandedItemLocationRect.height() == 0
16 | }
17 |
18 | companion object {
19 | val EMPTY = ExpandedItem(Rect(0, 0, 0, 0), null)
20 | }
21 | }
--------------------------------------------------------------------------------
/sushilib/src/main/java/com/zomato/sushilib/organisms/stacks/InternalPageCallbacks.kt:
--------------------------------------------------------------------------------
1 | package com.zomato.sushilib.organisms.stacks
2 |
3 | interface InternalPageCallbacks {
4 |
5 | fun onPageAboutToExpand()
6 |
7 | /**
8 | * Called when this page has fully covered the list. This can happen in two situations:
9 | * 1. when the page has fully expanded.
10 | * 2. when the page has moved back to its position after being pulled.
11 | */
12 | fun onPageFullyCovered()
13 |
14 | fun onPageAboutToCollapse()
15 |
16 | /** Page is no longer visible at this point. */
17 | fun onPageCollapsed()
18 |
19 | /** Page is being pulled. Sync the scroll with the list. */
20 | fun onPagePull(deltaY: Float, translationY: Float)
21 |
22 | /** Called when this page was released after being pulled. */
23 | fun onPageRelease(collapseEligible: Boolean)
24 |
25 | class NoOp : InternalPageCallbacks {
26 |
27 | override fun onPageAboutToExpand() {}
28 |
29 | override fun onPageFullyCovered() {}
30 |
31 | override fun onPageAboutToCollapse() {}
32 |
33 | override fun onPageCollapsed() {}
34 |
35 | override fun onPagePull(deltaY: Float, translationY: Float) {}
36 |
37 | override fun onPageRelease(collapseEligible: Boolean) {}
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/sushilib/src/main/java/com/zomato/sushilib/organisms/stacks/page/PageStateChangeCallbacks.kt:
--------------------------------------------------------------------------------
1 | package com.zomato.sushilib.organisms.stacks.page
2 |
3 | /**
4 | * Implement this to receive state callbacks for [ExpandablePageLayout].
5 | */
6 | interface PageStateChangeCallbacks {
7 |
8 | fun onPageAboutToExpand(expandAnimDuration: Long)
9 |
10 | fun onPageExpanded()
11 |
12 | fun onPageAboutToCollapse(collapseAnimDuration: Long)
13 |
14 | fun onPageCollapsed()
15 | }
16 |
--------------------------------------------------------------------------------
/sushilib/src/main/java/com/zomato/sushilib/utils/color/ColorContrastUtils.kt:
--------------------------------------------------------------------------------
1 | package com.zomato.sushilib.utils.color
2 |
3 | import androidx.annotation.RestrictTo
4 |
5 | @RestrictTo(RestrictTo.Scope.LIBRARY)
6 | internal object ColorContrastUtils {
7 | /**
8 | * Tells if the color is dark or not
9 | * For eg. if dark color, use a light font
10 | * on it
11 | * @param color Android color integer
12 | */
13 | @JvmStatic
14 | fun isDarkColor(color: Int): Boolean {
15 | val r = color shr 16 and 0xFF // Color.red(color)
16 | val g = color shr 8 and 0xFF // Color.green(color)
17 | val b = color and 0xFF // Color.blue(color)
18 | val yiq = ((r * 299) + (g * 587) + (b * 114)) / 1000
19 | return (yiq < 128)
20 | }
21 | }
--------------------------------------------------------------------------------
/sushilib/src/main/java/com/zomato/sushilib/utils/dimens/DimenUtils.kt:
--------------------------------------------------------------------------------
1 | package com.zomato.sushilib.utils.dimens
2 |
3 | import android.content.Context
4 |
5 | /**
6 | * created by championswimmer on 2019-07-15
7 | * Copyright (c) 2019 Zomato Media Pvt. Ltd.
8 | */
9 | object DimenUtils {
10 |
11 | @JvmStatic
12 | fun dp2px (context: Context, dp: Float): Float {
13 | val scale= context.resources.displayMetrics.density;
14 | return (dp * scale + 0.5f)
15 | }
16 |
17 | @JvmStatic
18 | fun px2dp(context: Context, px: Float): Int {
19 | val scale = context.resources.displayMetrics.density
20 | return (px / scale + 0.5f).toInt()
21 | }
22 | }
--------------------------------------------------------------------------------
/sushilib/src/main/java/com/zomato/sushilib/utils/text/TextFormatUtils.kt:
--------------------------------------------------------------------------------
1 | package com.zomato.sushilib.utils.text
2 |
3 | import androidx.annotation.RestrictTo
4 | import androidx.annotation.StyleRes
5 | import com.zomato.sushilib.R
6 | import com.zomato.sushilib.annotations.FontWeight
7 | import com.zomato.sushilib.annotations.FontWeight.*
8 |
9 | @RestrictTo(RestrictTo.Scope.LIBRARY)
10 | internal object TextFormatUtils {
11 | @JvmStatic
12 | @StyleRes
13 | fun textFontWeightToTextAppearance(@FontWeight textFontWeight: Int): Int {
14 | return when (textFontWeight) {
15 | THIN -> R.style.TextAppearance_Sushi_Thin
16 | EXTRALIGHT -> R.style.TextAppearance_Sushi_ExtraLight
17 | LIGHT -> R.style.TextAppearance_Sushi_Light
18 | REGULAR -> R.style.TextAppearance_Sushi_Regular
19 | MEDIUM -> R.style.TextAppearance_Sushi_Medium
20 | SEMIBOLD -> R.style.TextAppearance_Sushi_SemiBold
21 | BOLD -> R.style.TextAppearance_Sushi_Bold
22 | EXTRABOLD -> R.style.TextAppearance_Sushi_ExtraBold
23 | else -> R.style.TextAppearance_Sushi_Regular
24 | }
25 | }
26 | }
--------------------------------------------------------------------------------
/sushilib/src/main/java/com/zomato/sushilib/utils/theme/ResourceThemeResolver.kt:
--------------------------------------------------------------------------------
1 | package com.zomato.sushilib.utils.theme
2 |
3 | import android.content.Context
4 | import android.content.res.Resources
5 | import android.graphics.Typeface
6 | import android.graphics.drawable.Drawable
7 | import android.util.TypedValue
8 | import androidx.annotation.AttrRes
9 | import androidx.annotation.ColorInt
10 | import androidx.annotation.StyleRes
11 | import androidx.appcompat.view.ContextThemeWrapper
12 | import androidx.core.content.ContextCompat
13 | import androidx.core.content.res.ResourcesCompat
14 |
15 |
16 | /**
17 | * created by championswimmer on 09/04/19
18 | * Copyright (c) 2019 Zomato Media Pvt. Ltd.
19 | */
20 | object ResourceThemeResolver {
21 |
22 | /**
23 | * Creates a theme-wrapped context, given a context and a default style resId
24 | *
25 | * @param context Context wrapped with provided [defStyleRes]
26 | * or the same [context] is returned if no defStyleRes is provided
27 | * @param defStyleRes A style resource id
28 | */
29 | @JvmStatic
30 | fun getThemeWrappedContext(context: Context, @StyleRes defStyleRes: Int = 0): Context {
31 | return (if (defStyleRes == 0) {
32 | context
33 | } else {
34 | ContextThemeWrapper(context, defStyleRes)
35 | })
36 | }
37 |
38 | @JvmStatic
39 | fun getThemedFontFromAttr(context: Context, @AttrRes attrId: Int): Typeface? {
40 | val outValue = TypedValue()
41 | context.theme.resolveAttribute(
42 | attrId,
43 | outValue, true
44 | )
45 | return try {
46 | ResourcesCompat.getFont(context, outValue.resourceId)
47 | } catch (e: Resources.NotFoundException) {
48 | Typeface.DEFAULT
49 | }
50 | }
51 |
52 | @JvmStatic
53 | @ColorInt
54 | fun getThemedColorFromAttr(context: Context, @AttrRes attrId: Int): Int {
55 | val outValue = TypedValue()
56 | context.theme.resolveAttribute(
57 | attrId,
58 | outValue, true
59 | )
60 | return ContextCompat.getColor(context, outValue.resourceId)
61 | }
62 |
63 | @JvmStatic
64 | fun getThemedDimenPixelFromAttr(context: Context, @AttrRes attrId: Int): Int {
65 | val outValue = TypedValue()
66 | context.theme.resolveAttribute(
67 | attrId,
68 | outValue, true
69 | )
70 | return context.resources.getDimensionPixelSize(outValue.resourceId)
71 | }
72 |
73 | @JvmStatic
74 | fun getThemedDrawableFromAttr(context: Context, @AttrRes attrId: Int): Drawable? {
75 | val outValue = TypedValue()
76 | context.theme.resolveAttribute(
77 | attrId,
78 | outValue, true
79 | )
80 | return ContextCompat.getDrawable(context, outValue.resourceId)
81 | }
82 | }
--------------------------------------------------------------------------------
/sushilib/src/main/java/com/zomato/sushilib/utils/view/SushiViewOutlineProvider.kt:
--------------------------------------------------------------------------------
1 | package com.zomato.sushilib.utils.view
2 |
3 | import android.graphics.Outline
4 | import android.view.View
5 | import android.view.ViewOutlineProvider
6 | import com.zomato.sushilib.annotations.OutlineType
7 |
8 | /**
9 | * created by championswimmer on 26/03/19
10 | * Copyright (c) 2019 Zomato Media Pvt. Ltd.
11 | */
12 | class SushiViewOutlineProvider(
13 | @OutlineType
14 | val outlineType: Int = OutlineType.ROUNDED_RECT,
15 | var cornerRadius: Float = 0f,
16 | var paddingOutside: Boolean = false
17 | ) : ViewOutlineProvider() {
18 | var left: Int = 0
19 | var top: Int = 0
20 | var right: Int = 0
21 | var bottom: Int = 0
22 |
23 | override fun getOutline(view: View?, outline: Outline?) {
24 |
25 | view?.also { v ->
26 | left = if (paddingOutside) {
27 | v.paddingLeft
28 | } else {
29 | 0
30 | }
31 | top = if (paddingOutside) {
32 | v.paddingTop
33 | } else {
34 | 0
35 | }
36 | right = v.width - (if (paddingOutside) {
37 | v.paddingRight
38 | } else {
39 | 0
40 | })
41 | bottom = v.height - (if (paddingOutside) {
42 | v.paddingBottom
43 | } else {
44 | 0
45 | })
46 |
47 | if (outlineType == OutlineType.CIRCLE) {
48 | val radius = Math.min((right - left), (bottom - top)) / 2
49 | val centerX = (right + left) / 2
50 | val centerY = (bottom + top) / 2
51 | left = centerX - radius
52 | top = centerY - radius
53 | right = centerX + radius
54 | bottom = centerY + radius
55 | }
56 |
57 | when (outlineType) {
58 | OutlineType.CIRCLE -> {
59 | outline?.setOval(left, top, right, bottom)
60 | }
61 | OutlineType.ROUNDED_RECT -> {
62 | // TODO: Add oval check
63 | // TODO: When supporting corner flags
64 | // left -= cornerRadius.toInt()
65 | // top -= cornerRadius.toInt()
66 | // right += cornerRadius.toInt()
67 | // bottom += cornerRadius.toInt()
68 | outline?.setRoundRect(left, top, right, bottom, cornerRadius)
69 | }
70 | }
71 | }
72 | }
73 | }
--------------------------------------------------------------------------------
/sushilib/src/main/java/com/zomato/sushilib/utils/widgets/CompoundButtonHelper.kt:
--------------------------------------------------------------------------------
1 | package com.zomato.sushilib.utils.widgets
2 |
3 | import android.util.AttributeSet
4 | import android.widget.CompoundButton
5 | import androidx.annotation.AttrRes
6 | import androidx.annotation.ColorInt
7 | import androidx.annotation.RestrictTo
8 | import com.zomato.sushilib.R
9 | import com.zomato.sushilib.utils.theme.ResourceThemeResolver
10 |
11 | @RestrictTo(RestrictTo.Scope.LIBRARY)
12 | internal class CompoundButtonHelper(private val compoundButton: CompoundButton) {
13 |
14 | @ColorInt
15 | private var color: Int =
16 | ResourceThemeResolver.getThemedColorFromAttr(compoundButton.context, android.R.attr.colorControlActivated)
17 |
18 | fun init(attrs: AttributeSet?, @AttrRes defStyleAttr: Int) {
19 | compoundButton.context?.theme?.obtainStyledAttributes(
20 | attrs,
21 | R.styleable.SushiCompoundButton,
22 | 0, 0
23 | )?.let {
24 | color = it.getColor(R.styleable.SushiCompoundButton_controlColor, color)
25 | applyCompundButtonColor()
26 | it.recycle()
27 | }
28 | }
29 |
30 | fun setControlColor(@ColorInt color: Int) {
31 | if (this.color == color) return
32 | this.color = color
33 | applyCompundButtonColor()
34 | }
35 |
36 | private fun applyCompundButtonColor() {
37 | compoundButton.buttonTintList = CompoundButtonUtils.getBackgroundTintList(compoundButton.context, color)
38 | }
39 |
40 | }
--------------------------------------------------------------------------------
/sushilib/src/main/java/com/zomato/sushilib/utils/widgets/CompoundButtonUtils.kt:
--------------------------------------------------------------------------------
1 | package com.zomato.sushilib.utils.widgets
2 |
3 | import android.content.Context
4 | import android.content.res.ColorStateList
5 | import androidx.annotation.ColorInt
6 | import androidx.annotation.RestrictTo
7 | import androidx.core.content.ContextCompat
8 |
9 | @RestrictTo(RestrictTo.Scope.LIBRARY)
10 | internal object CompoundButtonUtils {
11 |
12 | fun getBackgroundTintList(context: Context, @ColorInt color: Int): ColorStateList {
13 | return ColorStateList(
14 | arrayOf(
15 | intArrayOf(android.R.attr.state_checked),
16 | intArrayOf()
17 | ),
18 | intArrayOf(
19 | color,
20 | ContextCompat.getColor(context, com.zomato.sushilib.R.color.sushi_grey_400)
21 | )
22 | )
23 | }
24 | }
--------------------------------------------------------------------------------
/sushilib/src/main/res/animator/sushi_click_depress_animator.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | -
4 |
5 |
10 |
11 |
16 |
17 |
18 |
19 |
20 | -
21 |
22 |
27 |
28 |
33 |
34 |
35 |
--------------------------------------------------------------------------------
/sushilib/src/main/res/animator/sushi_text_button_click_animator.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | -
4 |
5 |
11 |
12 |
13 |
14 | -
15 |
16 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/sushilib/src/main/res/color/sushi_bottom_nav_text_color_selector.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/sushilib/src/main/res/color/sushi_rating_color_selector.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/sushilib/src/main/res/drawable/sushi_rounded_icon_bg.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
--------------------------------------------------------------------------------
/sushilib/src/main/res/drawable/sushi_text_cursor.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/sushilib/src/main/res/layout/layout_bottom_navigation_bar_tab_view.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
11 |
12 |
20 |
--------------------------------------------------------------------------------
/sushilib/src/main/res/values-night/colors_button.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | @color/sushi_grey_800
4 | @color/sushi_grey_600
5 |
--------------------------------------------------------------------------------
/sushilib/src/main/res/values-night/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
11 |
--------------------------------------------------------------------------------
/sushilib/src/main/res/values/attrs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/sushilib/src/main/res/values/attrs_bottomnav.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/sushilib/src/main/res/values/attrs_button.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 |
--------------------------------------------------------------------------------
/sushilib/src/main/res/values/attrs_compund_btn.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 |
34 |
35 |
--------------------------------------------------------------------------------
/sushilib/src/main/res/values/attrs_edittext.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 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
--------------------------------------------------------------------------------
/sushilib/src/main/res/values/attrs_fonts.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/sushilib/src/main/res/values/attrs_imageview.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/sushilib/src/main/res/values/attrs_listings.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 |
--------------------------------------------------------------------------------
/sushilib/src/main/res/values/attrs_tag.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 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
--------------------------------------------------------------------------------
/sushilib/src/main/res/values/attrs_textview.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 |
--------------------------------------------------------------------------------
/sushilib/src/main/res/values/colors_button.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | @color/sushi_grey_200
4 | @color/sushi_grey_400
5 |
--------------------------------------------------------------------------------
/sushilib/src/main/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 9sp
4 | 11sp
5 | 12sp
6 | 13sp
7 | 15sp
8 | 17sp
9 | 19sp
10 | 21sp
11 | 24sp
12 | 27sp
13 |
14 | 0dp
15 | 1dp
16 | 2dp
17 | 4dp
18 | 6dp
19 | 8dp
20 | 12dp
21 | 16dp
22 | 24dp
23 | 32dp
24 |
25 | 8dp
26 | @dimen/sushi_spacing_base
27 | @dimen/sushi_spacing_micro
28 | @dimen/sushi_spacing_mini
29 | @dimen/sushi_spacing_nano
30 |
31 |
32 | 18dp
33 | 12dp
34 | 1dp
35 |
36 |
37 | 50dp
38 | 25dp
39 |
40 | 48dp
41 | 20dp
42 |
43 |
--------------------------------------------------------------------------------
/sushilib/src/main/res/values/dimens_button.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 18sp
5 | 14sp
6 | 12sp
7 |
8 | 48dp
9 | 32dp
10 | 25dp
11 |
12 | 1dp
13 | 4dp
14 | 8dp
15 |
--------------------------------------------------------------------------------
/sushilib/src/main/res/values/dimens_listings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 44dp
4 |
--------------------------------------------------------------------------------
/sushilib/src/main/res/values/dimens_tags.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | @dimen/sushi_spacing_macro
4 | @dimen/sushi_spacing_macro
5 |
6 | @dimen/sushi_spacing_mini
7 | @dimen/sushi_spacing_mini
8 |
9 | @dimen/sushi_spacing_micro
10 | @dimen/sushi_spacing_micro
11 |
12 | @dimen/sushi_spacing_nano
13 | 0dp
14 |
15 | @dimen/sushi_spacing_nano
16 | 0dp
17 |
18 | @dimen/sushi_textsize_400
19 | @dimen/sushi_textsize_300
20 | @dimen/sushi_textsize_200
21 | @dimen/sushi_textsize_100
22 | @dimen/sushi_textsize_050
23 |
24 | 3dp
25 | 4dp
26 | 30dp
27 |
28 | 50dp
29 | 40dp
30 | 35dp
31 | 30dp
32 | 20dp
33 |
--------------------------------------------------------------------------------
/sushilib/src/main/res/values/iconfont_mapping.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/sushilib/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | Sushi
3 |
4 |
--------------------------------------------------------------------------------
/sushilib/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
12 |
13 |
26 |
27 |
--------------------------------------------------------------------------------
/sushilib/src/main/res/values/styles_bottomnav.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
11 |
15 |
--------------------------------------------------------------------------------
/sushilib/src/main/res/values/styles_button.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
15 |
16 |
--------------------------------------------------------------------------------
/sushilib/src/main/res/values/styles_listings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
8 |
9 |
13 |
14 |
18 |
19 |
23 |
24 |
--------------------------------------------------------------------------------
/sushilib/src/main/res/values/styles_tablayout.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
14 |
15 |
21 |
22 |
--------------------------------------------------------------------------------
/sushilib/src/main/res/values/styles_tags.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
11 |
12 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/sushilib/src/main/res/values/styles_text.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
9 |
10 |
14 |
15 |
16 |
20 |
21 |
25 |
26 |
30 |
31 |
35 |
36 |
40 |
41 |
45 |
46 |
50 |
51 |
55 |
56 |
61 |
62 |
--------------------------------------------------------------------------------
/sushilib/src/main/res/values/styles_textfields.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 |
11 |
12 |
15 |
16 |
25 |
26 |
36 |
37 |
41 |
42 |
46 |
--------------------------------------------------------------------------------
/sushilib/src/test/java/com/zomato/sushilib/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package com.zomato.sushilib;
2 |
3 | import org.junit.Test;
4 |
5 | import static org.junit.Assert.*;
6 |
7 | /**
8 | * Example local unit test, which will execute on the development machine (host).
9 | *
10 | * @see Testing documentation
11 | */
12 | public class ExampleUnitTest {
13 | @Test
14 | public void addition_isCorrect() {
15 | assertEquals(4, 2 + 2);
16 | }
17 | }
--------------------------------------------------------------------------------
/sushilib/src/test/java/com/zomato/sushilib/utils/color/ColorContrastUtilsTests.kt:
--------------------------------------------------------------------------------
1 | package com.zomato.sushilib.utils.color
2 |
3 | import android.graphics.Color
4 | import org.junit.Test
5 | import org.junit.Assert.*
6 |
7 | class ColorContrastUtilsTests {
8 | @Test
9 | fun checkIsDarkWorks() {
10 | assertTrue(ColorContrastUtils.isDarkColor(Color.RED))
11 | assertFalse(ColorContrastUtils.isDarkColor(Color.YELLOW))
12 | }
13 | }
--------------------------------------------------------------------------------
/version.properties:
--------------------------------------------------------------------------------
1 | VERSION_CODE=1710000010
2 | VERSION_NAME=0.0.1
3 |
--------------------------------------------------------------------------------