├── .gradle ├── 4.8 │ ├── javaCompile │ │ ├── javaCompile.lock │ │ ├── processorPath.bin │ │ ├── taskHistory.bin │ │ └── taskJars.bin │ └── taskHistory │ │ ├── taskHistory.bin │ │ └── taskHistory.lock ├── buildOutputCleanup │ ├── buildOutputCleanup.lock │ ├── cache.properties │ └── outputFiles.bin └── vcsWorkingDirs │ └── gc.properties ├── .idea ├── caches │ └── build_file_checksums.ser ├── codeStyles │ └── Project.xml ├── gradle.xml └── libraries │ ├── Gradle__androidx_annotation_annotation_1_0_0_beta01_jar.xml │ ├── Gradle__androidx_appcompat_appcompat_1_0_0_beta01.xml │ ├── Gradle__androidx_arch_core_core_common_2_0_0_beta01_jar.xml │ └── Gradle__androidx_arch_core_core_runtime_2_0_0_beta01.xml ├── app ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ ├── main │ ├── AndroidManifest.xml │ ├── java │ │ └── com │ │ │ └── example │ │ │ └── yudizsolutionspvtltd │ │ │ └── materialapp │ │ │ ├── MaterialApplication.kt │ │ │ ├── backdrop │ │ │ ├── BackDropActivity.kt │ │ │ ├── NavigationIconClickListener.kt │ │ │ └── StaggeredProductCardRecyclerViewAdapter.kt │ │ │ ├── bottomAppBar │ │ │ ├── BottomAppbarBehaviourActivity.kt │ │ │ ├── BottomNavigationDrawerFragment.kt │ │ │ ├── BottomNavigationFragment.kt │ │ │ ├── ImageReq.kt │ │ │ ├── TravelCardRecyclerViewAdapter.kt │ │ │ ├── TravelEntry.kt │ │ │ └── TravelGridItemDecoration.kt │ │ │ └── login │ │ │ └── LoginActivity.kt │ └── res │ │ ├── ImageRequester.kt │ │ ├── drawable-v24 │ │ └── ic_launcher_foreground.xml │ │ ├── drawable │ │ ├── branded_menu.xml │ │ ├── close_menu.xml │ │ ├── ic_archive_black_24dp.xml │ │ ├── ic_arrow_forward_black_24dp.xml │ │ ├── ic_brightness_medium_black_24dp.xml │ │ ├── ic_cancel_black_24dp.xml │ │ ├── ic_dehaze_black_24dp.xml │ │ ├── ic_delete_black_24dp.xml │ │ ├── ic_favorite_black_24dp.xml │ │ ├── ic_filter_list_black_24dp.xml │ │ ├── ic_keyboard_return_black_24dp.xml │ │ ├── ic_launcher_background.xml │ │ ├── ic_local_florist_black_24dp.xml │ │ ├── ic_mail_black_24dp.xml │ │ ├── ic_menu_24dp.xml │ │ ├── ic_photo_size_select_large_black_24dp.xml │ │ ├── ic_rotate_left_black_24dp.xml │ │ ├── ic_search_white_24dp.xml │ │ ├── ic_small_black_24dp.xml │ │ ├── menu.xml │ │ ├── travel.jpeg │ │ ├── travel_grid_background_shape.xml │ │ └── travel_the_world_stock_hd_wallpaper.jpg │ │ ├── layout │ │ ├── activity_back_drop.xml │ │ ├── activity_bottom_app_behaviour.xml │ │ ├── activity_login.xml │ │ ├── content_main.xml │ │ ├── fragment_bottomsheet.xml │ │ ├── frg_drawer_navigation_drawer.xml │ │ ├── layout_backdrop.xml │ │ ├── product_card.xml │ │ ├── shr_staggered_product_card_first.xml │ │ ├── shr_staggered_product_card_second.xml │ │ └── shr_staggered_product_card_third.xml │ │ ├── menu │ │ ├── bottom_appbar_menu_primary.xml │ │ ├── bottom_appbar_menu_secondary.xml │ │ ├── bottom_nav_drawer_menu.xml │ │ ├── menu.xml │ │ └── toolbar_menu.xml │ │ ├── mipmap-anydpi-v26 │ │ ├── ic_launcher.xml │ │ └── ic_launcher_round.xml │ │ ├── mipmap-hdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-mdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-xhdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-xxhdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-xxxhdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── raw │ │ └── products.json │ │ └── values │ │ ├── colors.xml │ │ ├── strings.xml │ │ └── styles.xml │ └── test │ └── java │ └── com │ └── example │ └── yudizsolutionspvtltd │ └── materialapp │ └── ExampleUnitTest.kt ├── build.gradle ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── local.properties └── settings.gradle /.gradle/4.8/javaCompile/javaCompile.lock: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yudiz-solutions/material-design-android/12421dbdb5c1c84195d91021a043053d9a28ee9f/.gradle/4.8/javaCompile/javaCompile.lock -------------------------------------------------------------------------------- /.gradle/4.8/javaCompile/processorPath.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yudiz-solutions/material-design-android/12421dbdb5c1c84195d91021a043053d9a28ee9f/.gradle/4.8/javaCompile/processorPath.bin -------------------------------------------------------------------------------- /.gradle/4.8/javaCompile/taskHistory.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yudiz-solutions/material-design-android/12421dbdb5c1c84195d91021a043053d9a28ee9f/.gradle/4.8/javaCompile/taskHistory.bin -------------------------------------------------------------------------------- /.gradle/4.8/javaCompile/taskJars.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yudiz-solutions/material-design-android/12421dbdb5c1c84195d91021a043053d9a28ee9f/.gradle/4.8/javaCompile/taskJars.bin -------------------------------------------------------------------------------- /.gradle/4.8/taskHistory/taskHistory.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yudiz-solutions/material-design-android/12421dbdb5c1c84195d91021a043053d9a28ee9f/.gradle/4.8/taskHistory/taskHistory.bin -------------------------------------------------------------------------------- /.gradle/4.8/taskHistory/taskHistory.lock: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yudiz-solutions/material-design-android/12421dbdb5c1c84195d91021a043053d9a28ee9f/.gradle/4.8/taskHistory/taskHistory.lock -------------------------------------------------------------------------------- /.gradle/buildOutputCleanup/buildOutputCleanup.lock: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yudiz-solutions/material-design-android/12421dbdb5c1c84195d91021a043053d9a28ee9f/.gradle/buildOutputCleanup/buildOutputCleanup.lock -------------------------------------------------------------------------------- /.gradle/buildOutputCleanup/cache.properties: -------------------------------------------------------------------------------- 1 | #Wed Jul 25 14:23:02 IST 2018 2 | gradle.version=4.8 3 | -------------------------------------------------------------------------------- /.gradle/buildOutputCleanup/outputFiles.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yudiz-solutions/material-design-android/12421dbdb5c1c84195d91021a043053d9a28ee9f/.gradle/buildOutputCleanup/outputFiles.bin -------------------------------------------------------------------------------- /.gradle/vcsWorkingDirs/gc.properties: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yudiz-solutions/material-design-android/12421dbdb5c1c84195d91021a043053d9a28ee9f/.gradle/vcsWorkingDirs/gc.properties -------------------------------------------------------------------------------- /.idea/caches/build_file_checksums.ser: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yudiz-solutions/material-design-android/12421dbdb5c1c84195d91021a043053d9a28ee9f/.idea/caches/build_file_checksums.ser -------------------------------------------------------------------------------- /.idea/codeStyles/Project.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 15 | 16 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /.idea/gradle.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 17 | 18 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__androidx_annotation_annotation_1_0_0_beta01_jar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__androidx_appcompat_appcompat_1_0_0_beta01.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__androidx_arch_core_core_common_2_0_0_beta01_jar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__androidx_arch_core_core_runtime_2_0_0_beta01.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | apply plugin: 'kotlin-android' 4 | 5 | apply plugin: 'kotlin-android-extensions' 6 | 7 | android { 8 | compileSdkVersion 28 9 | defaultConfig { 10 | applicationId "com.example.yudizsolutionspvtltd.materialapp" 11 | minSdkVersion 21 12 | targetSdkVersion 28 13 | versionCode 1 14 | versionName "1.0" 15 | vectorDrawables.useSupportLibrary = true 16 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" 17 | } 18 | buildTypes { 19 | release { 20 | minifyEnabled false 21 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' 22 | } 23 | } 24 | } 25 | 26 | dependencies { 27 | implementation fileTree(include: ['*.jar'], dir: 'libs') 28 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" 29 | implementation 'androidx.appcompat:appcompat:1.0.0-beta01' 30 | implementation 'androidx.constraintlayout:constraintlayout:1.1.2' 31 | implementation 'com.google.android.material:material:1.0.0-beta01' 32 | implementation 'com.intuit.sdp:sdp-android:1.0.5' 33 | implementation 'com.android.volley:volley:1.1.0' 34 | implementation 'com.google.code.gson:gson:2.8.2' 35 | } 36 | -------------------------------------------------------------------------------- /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/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /app/src/main/java/com/example/yudizsolutionspvtltd/materialapp/MaterialApplication.kt: -------------------------------------------------------------------------------- 1 | package com.example.yudizsolutionspvtltd.materialapp 2 | 3 | import android.app.Application 4 | import android.content.Context 5 | import androidx.appcompat.app.AppCompatDelegate 6 | 7 | class MaterialApplication : Application() { 8 | companion object { 9 | lateinit var instance: MaterialApplication 10 | private set 11 | } 12 | 13 | override fun onCreate() { 14 | super.onCreate() 15 | instance = this 16 | 17 | AppCompatDelegate.setCompatVectorFromResourcesEnabled(true) 18 | } 19 | 20 | } -------------------------------------------------------------------------------- /app/src/main/java/com/example/yudizsolutionspvtltd/materialapp/backdrop/BackDropActivity.kt: -------------------------------------------------------------------------------- 1 | package com.example.yudizsolutionspvtltd.materialapp.backdrop 2 | 3 | import android.os.Build 4 | import androidx.appcompat.app.AppCompatActivity 5 | import android.os.Bundle 6 | import android.view.Menu 7 | import android.view.animation.AccelerateDecelerateInterpolator 8 | import androidx.core.content.ContextCompat 9 | import androidx.recyclerview.widget.GridLayoutManager 10 | import com.example.yudizsolutionspvtltd.materialapp.R 11 | import com.example.yudizsolutionspvtltd.materialapp.bottomAppBar.ProductCardRecyclerViewAdapter 12 | import com.example.yudizsolutionspvtltd.materialapp.bottomAppBar.TravelEntry 13 | import com.example.yudizsolutionspvtltd.materialapp.bottomAppBar.TravelGridItemDecoration 14 | import kotlinx.android.synthetic.main.activity_back_drop.* 15 | 16 | class BackDropActivity : AppCompatActivity() { 17 | 18 | override fun onCreate(savedInstanceState: Bundle?) { 19 | super.onCreate(savedInstanceState) 20 | setContentView(R.layout.activity_back_drop) 21 | this.setSupportActionBar(app_bar) 22 | app_bar.setNavigationOnClickListener(NavigationIconClickListener( 23 | this, 24 | recycler_view, 25 | AccelerateDecelerateInterpolator(), 26 | ContextCompat.getDrawable(this, R.drawable.branded_menu), 27 | ContextCompat.getDrawable(this, R.drawable.close_menu))) 28 | 29 | recycler_view.layoutManager = GridLayoutManager(this, 2, GridLayoutManager.VERTICAL, false) 30 | val adapter = ProductCardRecyclerViewAdapter( 31 | TravelEntry.initProductEntryList(resources)) 32 | recycler_view.adapter = adapter 33 | val largePadding = resources.getDimensionPixelSize(R.dimen._16sdp) 34 | val smallPadding = resources.getDimensionPixelSize(R.dimen._4sdp) 35 | recycler_view.addItemDecoration(TravelGridItemDecoration(largePadding, smallPadding)) 36 | } 37 | 38 | override fun onCreateOptionsMenu(menu: Menu): Boolean { 39 | val inflater = menuInflater 40 | inflater.inflate(R.menu.toolbar_menu, menu) 41 | return true 42 | } 43 | 44 | 45 | } 46 | -------------------------------------------------------------------------------- /app/src/main/java/com/example/yudizsolutionspvtltd/materialapp/backdrop/NavigationIconClickListener.kt: -------------------------------------------------------------------------------- 1 | package com.example.yudizsolutionspvtltd.materialapp.backdrop 2 | 3 | import android.animation.AnimatorSet 4 | import android.animation.ObjectAnimator 5 | import android.app.Activity 6 | import android.content.Context 7 | import android.graphics.drawable.Drawable 8 | import android.util.DisplayMetrics 9 | import android.view.View 10 | import android.view.animation.Interpolator 11 | import android.widget.ImageView 12 | import com.example.yudizsolutionspvtltd.materialapp.R 13 | 14 | class NavigationIconClickListener @JvmOverloads internal constructor( 15 | private val context: Context, private val sheet: View, private val interpolator: Interpolator? = null, 16 | private val openIcon: Drawable? = null, private val closeIcon: Drawable? = null) : View.OnClickListener { 17 | 18 | private val animatorSet = AnimatorSet() 19 | private val height: Int 20 | private var backdropShown = false 21 | 22 | init { 23 | val displayMetrics = DisplayMetrics() 24 | (context as Activity).windowManager.defaultDisplay.getMetrics(displayMetrics) 25 | height = displayMetrics.heightPixels 26 | } 27 | 28 | override fun onClick(view: View) { 29 | backdropShown = !backdropShown 30 | animatorSet.removeAllListeners() 31 | animatorSet.end() 32 | animatorSet.cancel() 33 | 34 | updateIcon(view) 35 | val translateY = height - context.resources.getDimensionPixelSize(R.dimen._140sdp) 36 | val animator = ObjectAnimator.ofFloat(sheet, "translationY", (if (backdropShown) translateY else 0).toFloat()) 37 | animator.duration = 500 38 | if (interpolator != null) { 39 | animator.interpolator = interpolator 40 | } 41 | animatorSet.play(animator) 42 | animator.start() 43 | } 44 | 45 | private fun updateIcon(view: View) { 46 | if (openIcon != null && closeIcon != null) { 47 | if (view !is ImageView) { 48 | throw IllegalArgumentException("updateIcon() must be called on an ImageView") 49 | } 50 | if (backdropShown) { 51 | view.setImageDrawable(closeIcon) 52 | } else { 53 | view.setImageDrawable(openIcon) 54 | } 55 | } 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /app/src/main/java/com/example/yudizsolutionspvtltd/materialapp/backdrop/StaggeredProductCardRecyclerViewAdapter.kt: -------------------------------------------------------------------------------- 1 | package com.example.yudizsolutionspvtltd.materialapp.backdrop 2 | 3 | import android.view.LayoutInflater 4 | import android.view.View 5 | import android.view.ViewGroup 6 | import android.widget.TextView 7 | import androidx.recyclerview.widget.RecyclerView 8 | import com.android.volley.toolbox.NetworkImageView 9 | import com.example.yudizsolutionspvtltd.materialapp.R 10 | import com.example.yudizsolutionspvtltd.materialapp.bottomAppBar.ImageReq 11 | import com.example.yudizsolutionspvtltd.materialapp.bottomAppBar.TravelEntry 12 | 13 | class StaggeredProductCardRecyclerViewAdapter(private val productList: List?) : RecyclerView.Adapter() { 14 | 15 | override fun getItemViewType(position: Int): Int { 16 | return position % 3 17 | } 18 | 19 | override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): StaggeredProductCardViewHolder { 20 | var layoutId = R.layout.shr_staggered_product_card_first 21 | if (viewType == 1) { 22 | layoutId = R.layout.shr_staggered_product_card_second 23 | } else if (viewType == 2) { 24 | layoutId = R.layout.shr_staggered_product_card_third 25 | } 26 | val layoutView = LayoutInflater.from(parent.context).inflate(layoutId, parent, false) 27 | return StaggeredProductCardViewHolder(layoutView) 28 | } 29 | 30 | override fun onBindViewHolder(holder: StaggeredProductCardViewHolder, position: Int) { 31 | if (productList != null && position < productList.size) { 32 | val product = productList[position] 33 | holder.productTitle.text = product.title 34 | holder.productPrice.text = product.price 35 | ImageReq.setImageFromUrl(holder.productImage, product.url) 36 | } 37 | } 38 | 39 | override fun getItemCount(): Int { 40 | return productList?.size ?: 0 41 | } 42 | } 43 | 44 | class StaggeredProductCardViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) { 45 | 46 | var productImage: NetworkImageView = itemView.findViewById(R.id.product_image) 47 | var productTitle: TextView = itemView.findViewById(R.id.product_title) 48 | var productPrice: TextView = itemView.findViewById(R.id.product_price) 49 | } 50 | 51 | -------------------------------------------------------------------------------- /app/src/main/java/com/example/yudizsolutionspvtltd/materialapp/bottomAppBar/BottomAppbarBehaviourActivity.kt: -------------------------------------------------------------------------------- 1 | package com.example.yudizsolutionspvtltd.materialapp.bottomAppBar 2 | 3 | import android.content.Intent 4 | import android.os.Build 5 | import android.os.Bundle 6 | import android.view.Menu 7 | import android.view.MenuItem 8 | import android.view.WindowManager 9 | import android.widget.Toast 10 | import androidx.annotation.RequiresApi 11 | import androidx.appcompat.app.AppCompatActivity 12 | import androidx.coordinatorlayout.widget.CoordinatorLayout 13 | import androidx.core.content.ContextCompat 14 | import androidx.recyclerview.widget.GridLayoutManager 15 | import com.example.yudizsolutionspvtltd.materialapp.R 16 | import com.example.yudizsolutionspvtltd.materialapp.backdrop.BackDropActivity 17 | import com.example.yudizsolutionspvtltd.materialapp.backdrop.StaggeredProductCardRecyclerViewAdapter 18 | import com.google.android.material.bottomappbar.BottomAppBar 19 | import com.google.android.material.snackbar.Snackbar 20 | import kotlinx.android.synthetic.main.activity_bottom_app_behaviour.* 21 | 22 | class BottomAppbarBehaviourActivity : AppCompatActivity() { 23 | 24 | var counter = 0 25 | @RequiresApi(Build.VERSION_CODES.M) 26 | override fun onCreate(savedInstanceState: Bundle?) { 27 | super.onCreate(savedInstanceState) 28 | setContentView(R.layout.activity_bottom_app_behaviour) 29 | setSupportActionBar(appbar) 30 | setCardRecyclerView() 31 | changeStatusBarColor(this.getColor(android.R.color.white)) 32 | listener() 33 | 34 | } 35 | 36 | fun changeStatusBarColor(color: Int) { 37 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { 38 | val window = window 39 | window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS) 40 | window.statusBarColor = color 41 | } 42 | } 43 | 44 | fun resetFabChanges(){ 45 | counter=0 46 | appbar.navigationIcon = this.getDrawable(R.drawable.ic_menu_24dp) 47 | appbar.fabAlignmentMode = BottomAppBar.FAB_ALIGNMENT_MODE_CENTER 48 | appbar.replaceMenu(R.menu.bottom_appbar_menu_primary) 49 | fab_bar?.setImageDrawable(this.getDrawable(R.drawable.ic_local_florist_black_24dp)) 50 | } 51 | private fun listener() { 52 | fab_bar.setOnClickListener { 53 | if (counter == 0) { 54 | counter++ 55 | appbar.navigationIcon = null 56 | appbar.fabAlignmentMode = BottomAppBar.FAB_ALIGNMENT_MODE_END 57 | appbar.replaceMenu(R.menu.bottom_appbar_menu_secondary) 58 | fab_bar?.setImageDrawable(this.getDrawable(R.drawable.ic_keyboard_return_black_24dp)) 59 | } else { 60 | var iNagigation = Intent(this, BackDropActivity::class.java) 61 | startActivity(iNagigation) 62 | } 63 | } 64 | } 65 | // app_bar.setNavigationItemSelectedListener { menuItem -> 66 | // // // Bottom Navigation Drawer menu item clicks 67 | // when (menuItem!!.itemId) { 68 | // R.id.nav1 -> context!!.toast(getString(R.string.nav1_clicked)) 69 | // R.id.nav2 -> context!!.toast(getString(R.string.nav2_clicked)) 70 | // R.id.nav3 -> context!!.toast(getString(R.string.nav3_clicked)) 71 | // } 72 | // true 73 | // } 74 | 75 | 76 | private fun toast(text: String) { 77 | Toast.makeText(this, text, Toast.LENGTH_LONG).show() 78 | } 79 | 80 | private fun setCardRecyclerView() { 81 | recycler_view.setHasFixedSize(true) 82 | val gridLayoutManager = GridLayoutManager(this, 2, GridLayoutManager.HORIZONTAL, false) 83 | gridLayoutManager.spanSizeLookup = object : GridLayoutManager.SpanSizeLookup() { 84 | override fun getSpanSize(position: Int): Int { 85 | return if (position % 3 == 2) 2 else 1 86 | } 87 | } 88 | recycler_view.layoutManager = gridLayoutManager 89 | val adapter = StaggeredProductCardRecyclerViewAdapter( 90 | TravelEntry.initProductEntryList(resources)) 91 | recycler_view.adapter = adapter 92 | val largePadding = resources.getDimensionPixelSize(R.dimen._10sdp) 93 | val smallPadding = resources.getDimensionPixelSize(R.dimen._10sdp) 94 | recycler_view.addItemDecoration(TravelGridItemDecoration(largePadding, smallPadding)) 95 | } 96 | 97 | override fun onCreateOptionsMenu(menu: Menu): Boolean { 98 | val inflater = menuInflater 99 | inflater.inflate(R.menu.bottom_appbar_menu_primary, menu) 100 | return true 101 | } 102 | 103 | private fun displayMaterialSnackBar() { 104 | val marginSide = 0 105 | val marginBottom = 550 106 | val snackbar = Snackbar.make( 107 | toolbar, 108 | "FAB Clicked", 109 | Snackbar.LENGTH_LONG 110 | ).setAction("UNDO") { } 111 | snackbar.setActionTextColor(ContextCompat.getColor(this, R.color.colorAccent)) 112 | 113 | val snackbarView = snackbar.view 114 | val params = snackbarView.layoutParams as CoordinatorLayout.LayoutParams 115 | 116 | params.setMargins( 117 | params.leftMargin + marginSide, 118 | params.topMargin, 119 | params.rightMargin + marginSide, 120 | params.bottomMargin + marginBottom 121 | ) 122 | 123 | snackbarView.layoutParams = params 124 | snackbar.show() 125 | } 126 | 127 | override fun onOptionsItemSelected(item: MenuItem?): Boolean { 128 | when (item!!.itemId) { 129 | android.R.id.home -> { 130 | val bottomNavDrawerFragment = BottomNavigationDrawerFragment() 131 | bottomNavDrawerFragment.show(supportFragmentManager, bottomNavDrawerFragment.tag) 132 | } 133 | R.id.app_bar_fav -> Toast.makeText(this, "Fav menu item is clicked!", Toast.LENGTH_LONG).show() 134 | R.id.app_bar_search -> Toast.makeText(this, "Search menu item is clicked!", Toast.LENGTH_LONG).show() 135 | R.id.app_bar_settings -> Toast.makeText(this, "Settings item is clicked!", Toast.LENGTH_LONG).show() 136 | R.id.app_bar_archieve -> resetFabChanges() 137 | } 138 | return true 139 | } 140 | 141 | 142 | // override fun onOptionsItemSelected(item: MenuItem?): Boolean { 143 | // when (item!!.itemId) { 144 | // R.id.app_bar_fav -> Toast.makeText(this, "Fav menu item is clicked!", Toast.LENGTH_LONG).show() 145 | // R.id.app_bar_search -> Toast.makeText(this, "Search menu item is clicked!", Toast.LENGTH_LONG).show() 146 | // R.id.app_bar_settings -> Toast.makeText(this, "Settings item is clicked!", Toast.LENGTH_LONG).show() 147 | // 148 | // } 149 | // 150 | // return true 151 | // } 152 | } 153 | -------------------------------------------------------------------------------- /app/src/main/java/com/example/yudizsolutionspvtltd/materialapp/bottomAppBar/BottomNavigationDrawerFragment.kt: -------------------------------------------------------------------------------- 1 | package com.example.yudizsolutionspvtltd.materialapp.bottomAppBar 2 | 3 | import android.os.Bundle 4 | import android.view.LayoutInflater 5 | import android.view.View 6 | import android.view.ViewGroup 7 | import android.widget.Toast 8 | import com.example.yudizsolutionspvtltd.materialapp.R 9 | import com.google.android.material.bottomsheet.BottomSheetDialogFragment 10 | import kotlinx.android.synthetic.main.fragment_bottomsheet.* 11 | 12 | class BottomNavigationDrawerFragment : BottomSheetDialogFragment() { 13 | 14 | override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { 15 | return inflater.inflate(R.layout.fragment_bottomsheet, container, false) 16 | 17 | } 18 | override fun onActivityCreated(savedInstanceState: Bundle?) { 19 | super.onActivityCreated(savedInstanceState) 20 | navigation_view.setNavigationItemSelectedListener { menuItem -> 21 | 22 | when (menuItem.itemId) { 23 | R.id.nav1 -> Toast.makeText(activity, "Nav 1 clicked", Toast.LENGTH_LONG).show() 24 | R.id.nav2 -> Toast.makeText(activity, "Nav 2 clicked", Toast.LENGTH_LONG).show() 25 | R.id.nav3 -> Toast.makeText(activity, "Nav 3 clicked", Toast.LENGTH_LONG).show() 26 | } 27 | true 28 | } 29 | } 30 | } -------------------------------------------------------------------------------- /app/src/main/java/com/example/yudizsolutionspvtltd/materialapp/bottomAppBar/BottomNavigationFragment.kt: -------------------------------------------------------------------------------- 1 | package com.example.yudizsolutionspvtltd.materialapp.bottomAppBar 2 | 3 | import android.os.Bundle 4 | import android.view.LayoutInflater 5 | import android.view.View 6 | import android.view.ViewGroup 7 | import com.example.yudizsolutionspvtltd.materialapp.R 8 | import com.google.android.material.bottomsheet.BottomSheetDialogFragment 9 | import kotlinx.android.synthetic.main.frg_drawer_navigation_drawer.* 10 | 11 | class BottomNavigationFragment : BottomSheetDialogFragment() { 12 | 13 | override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { 14 | return inflater.inflate(R.layout.frg_drawer_navigation_drawer, container, false) 15 | } 16 | 17 | override fun onActivityCreated(savedInstanceState: Bundle?) { 18 | super.onActivityCreated(savedInstanceState) 19 | 20 | navigation_view.setNavigationItemSelectedListener { menuItem -> 21 | // Bottom Navigation Drawer menu item clicks 22 | when (menuItem.itemId) { 23 | // R.id.nav1 -> context!!.toast(getString(R.string.nav1_clicked)) 24 | } 25 | // Add code here to update the UI based on the item selected 26 | // For example, swap UI fragments here 27 | true 28 | } 29 | } 30 | } -------------------------------------------------------------------------------- /app/src/main/java/com/example/yudizsolutionspvtltd/materialapp/bottomAppBar/ImageReq.kt: -------------------------------------------------------------------------------- 1 | package com.example.yudizsolutionspvtltd.materialapp.bottomAppBar 2 | 3 | import android.content.Context 4 | import android.graphics.Bitmap 5 | import android.util.LruCache 6 | 7 | import com.android.volley.RequestQueue 8 | import com.android.volley.toolbox.ImageLoader 9 | import com.android.volley.toolbox.NetworkImageView 10 | import com.android.volley.toolbox.Volley 11 | import com.example.yudizsolutionspvtltd.materialapp.MaterialApplication 12 | 13 | object ImageReq { 14 | private val requestQueue: RequestQueue 15 | private val imageLoader: ImageLoader 16 | private val maxByteSize: Int 17 | 18 | init { 19 | val context = MaterialApplication.instance 20 | requestQueue = Volley.newRequestQueue(context) 21 | requestQueue.start() 22 | maxByteSize = calculateMaxByteSize(context) 23 | imageLoader = ImageLoader( 24 | requestQueue, 25 | object : ImageLoader.ImageCache { 26 | private val lruCache = object : LruCache(maxByteSize) { 27 | override fun sizeOf(url: String, bitmap: Bitmap): Int { 28 | return bitmap.byteCount 29 | } 30 | } 31 | 32 | @Synchronized 33 | override fun getBitmap(url: String): Bitmap? { 34 | return lruCache.get(url) 35 | } 36 | 37 | @Synchronized 38 | override fun putBitmap(url: String, bitmap: Bitmap) { 39 | lruCache.put(url, bitmap) 40 | } 41 | }) 42 | } 43 | fun setImageFromUrl(networkImageView: NetworkImageView, url: String) { 44 | networkImageView.setImageUrl(url, imageLoader) 45 | } 46 | 47 | private fun calculateMaxByteSize(context: Context): Int { 48 | val displayMetrics = context.resources.displayMetrics 49 | val screenBytes = displayMetrics.widthPixels * displayMetrics.heightPixels * 4 50 | return screenBytes * 3 51 | } 52 | } -------------------------------------------------------------------------------- /app/src/main/java/com/example/yudizsolutionspvtltd/materialapp/bottomAppBar/TravelCardRecyclerViewAdapter.kt: -------------------------------------------------------------------------------- 1 | package com.example.yudizsolutionspvtltd.materialapp.bottomAppBar 2 | 3 | import android.view.LayoutInflater 4 | import android.view.View 5 | import android.view.ViewGroup 6 | import android.widget.TextView 7 | import androidx.recyclerview.widget.RecyclerView 8 | import com.android.volley.toolbox.NetworkImageView 9 | import com.example.yudizsolutionspvtltd.materialapp.R 10 | 11 | class ProductCardRecyclerViewAdapter internal constructor(private val productList: List) : RecyclerView.Adapter() { 12 | 13 | override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ProductCardViewHolder { 14 | val layoutView = LayoutInflater.from(parent.context).inflate(R.layout.product_card, parent, false) 15 | return ProductCardViewHolder(layoutView) 16 | } 17 | 18 | override fun onBindViewHolder(holder: ProductCardViewHolder, position: Int) { 19 | if (position < productList.size) { 20 | val product = productList[position] 21 | holder.productTitle.text = product.title 22 | holder.productPrice.text = product.price 23 | println("product url" + product.url) 24 | ImageReq.setImageFromUrl(holder.productImage, product.url) 25 | } 26 | } 27 | 28 | override fun getItemCount(): Int { 29 | return productList.size 30 | } 31 | 32 | 33 | } 34 | 35 | class ProductCardViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) { 36 | 37 | var productImage: NetworkImageView = itemView.findViewById(R.id.product_image) 38 | var productTitle: TextView = itemView.findViewById(R.id.product_title) 39 | var productPrice: TextView = itemView.findViewById(R.id.product_price) 40 | } 41 | -------------------------------------------------------------------------------- /app/src/main/java/com/example/yudizsolutionspvtltd/materialapp/bottomAppBar/TravelEntry.kt: -------------------------------------------------------------------------------- 1 | package com.example.yudizsolutionspvtltd.materialapp.bottomAppBar 2 | 3 | import android.content.res.Resources 4 | import android.net.Uri 5 | import com.example.yudizsolutionspvtltd.materialapp.R 6 | import com.google.gson.Gson 7 | import com.google.gson.reflect.TypeToken 8 | import java.io.BufferedReader 9 | import java.util.* 10 | 11 | class TravelEntry( 12 | val title: String, dynamicUrl: String, val url: String, val price: String, val description: String) { 13 | val dynamicUrl: Uri = Uri.parse(dynamicUrl) 14 | 15 | companion object { 16 | fun initProductEntryList(resources: Resources): List { 17 | val inputStream = resources.openRawResource(R.raw.products) 18 | val jsonProductsString = inputStream.bufferedReader().use(BufferedReader::readText) 19 | val gson = Gson() 20 | val productListType = object : TypeToken>() {}.type 21 | return gson.fromJson>(jsonProductsString, productListType) 22 | } 23 | } 24 | } -------------------------------------------------------------------------------- /app/src/main/java/com/example/yudizsolutionspvtltd/materialapp/bottomAppBar/TravelGridItemDecoration.kt: -------------------------------------------------------------------------------- 1 | package com.example.yudizsolutionspvtltd.materialapp.bottomAppBar 2 | 3 | import android.graphics.Rect 4 | import android.view.View 5 | import androidx.recyclerview.widget.RecyclerView 6 | class TravelGridItemDecoration(private val largePadding: Int, private val smallPadding: Int) : RecyclerView.ItemDecoration() { 7 | 8 | override fun getItemOffsets(outRect: Rect, view: View, 9 | parent: RecyclerView, state: RecyclerView.State) { 10 | outRect.left = smallPadding 11 | outRect.right = smallPadding 12 | outRect.top = largePadding 13 | outRect.bottom = largePadding 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /app/src/main/java/com/example/yudizsolutionspvtltd/materialapp/login/LoginActivity.kt: -------------------------------------------------------------------------------- 1 | package com.example.yudizsolutionspvtltd.materialapp.login 2 | 3 | import android.content.Intent 4 | import android.os.Build 5 | import androidx.appcompat.app.AppCompatActivity 6 | import android.os.Bundle 7 | import android.view.WindowManager 8 | import androidx.annotation.RequiresApi 9 | import com.example.yudizsolutionspvtltd.materialapp.bottomAppBar.BottomAppbarBehaviourActivity 10 | import com.example.yudizsolutionspvtltd.materialapp.R 11 | import kotlinx.android.synthetic.main.activity_login.* 12 | 13 | class LoginActivity : AppCompatActivity() { 14 | 15 | @RequiresApi(Build.VERSION_CODES.M) 16 | override fun onCreate(savedInstanceState: Bundle?) { 17 | super.onCreate(savedInstanceState) 18 | setContentView(R.layout.activity_login) 19 | next_button?.setOnClickListener { 20 | var iNavigation=Intent(this, BottomAppbarBehaviourActivity::class.java) 21 | startActivity(iNavigation) 22 | } 23 | changeStatusBarColor(this.getColor(android.R.color.white)) 24 | 25 | } 26 | fun changeStatusBarColor(color: Int) { 27 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { 28 | val window = window 29 | window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS) 30 | window.statusBarColor = color 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /app/src/main/res/ImageRequester.kt: -------------------------------------------------------------------------------- 1 | package com.example.yudizsolutionspvtltd.materialapp 2 | import android.content.Context 3 | import android.graphics.Bitmap 4 | import android.util.LruCache 5 | import com.android.volley.RequestQueue 6 | import com.android.volley.toolbox.ImageLoader 7 | import com.android.volley.toolbox.NetworkImageView 8 | import com.android.volley.toolbox.Volley 9 | import com.example.yudizsolutionspvtltd.materialapp.MaterialApplication 10 | 11 | object ImageRequester { 12 | private val requestQueue: RequestQueue 13 | private val imageLoader: ImageLoader 14 | private val maxByteSize: Int 15 | 16 | init { 17 | val context = MaterialApplication.instance 18 | this.requestQueue = Volley.newRequestQueue(context) 19 | this.requestQueue.start() 20 | this.maxByteSize = calculateMaxByteSize(context) 21 | this.imageLoader = ImageLoader( 22 | requestQueue, 23 | object : ImageLoader.ImageCache { 24 | private val lruCache = object : LruCache(maxByteSize) { 25 | override fun sizeOf(url: String, bitmap: Bitmap): Int { 26 | return bitmap.byteCount 27 | } 28 | } 29 | 30 | @Synchronized 31 | override fun getBitmap(url: String): Bitmap? { 32 | return lruCache.get(url) 33 | } 34 | 35 | @Synchronized 36 | override fun putBitmap(url: String, bitmap: Bitmap) { 37 | lruCache.put(url, bitmap) 38 | } 39 | }) 40 | } 41 | fun setImageFromUrl(networkImageView: NetworkImageView, url: String) { 42 | networkImageView.setImageUrl(url, imageLoader) 43 | } 44 | 45 | private fun calculateMaxByteSize(context: Context): Int { 46 | val displayMetrics = context.resources.displayMetrics 47 | val screenBytes = displayMetrics.widthPixels * displayMetrics.heightPixels * 4 48 | return screenBytes * 3 49 | } 50 | } -------------------------------------------------------------------------------- /app/src/main/res/drawable-v24/ic_launcher_foreground.xml: -------------------------------------------------------------------------------- 1 | 7 | 12 | 13 | 19 | 22 | 25 | 26 | 27 | 28 | 34 | 35 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/branded_menu.xml: -------------------------------------------------------------------------------- 1 | 7 | 13 | 14 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/close_menu.xml: -------------------------------------------------------------------------------- 1 | 7 | 10 | 11 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_archive_black_24dp.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_arrow_forward_black_24dp.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_brightness_medium_black_24dp.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_cancel_black_24dp.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_dehaze_black_24dp.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_delete_black_24dp.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_favorite_black_24dp.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_filter_list_black_24dp.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_keyboard_return_black_24dp.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_launcher_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 10 | 15 | 20 | 25 | 30 | 35 | 40 | 45 | 50 | 55 | 60 | 65 | 70 | 75 | 80 | 85 | 90 | 95 | 100 | 105 | 110 | 115 | 120 | 125 | 130 | 135 | 140 | 145 | 150 | 155 | 160 | 165 | 170 | 171 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_local_florist_black_24dp.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_mail_black_24dp.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_menu_24dp.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_photo_size_select_large_black_24dp.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_rotate_left_black_24dp.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_search_white_24dp.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_small_black_24dp.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/menu.xml: -------------------------------------------------------------------------------- 1 | 7 | 10 | 11 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/travel.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yudiz-solutions/material-design-android/12421dbdb5c1c84195d91021a043053d9a28ee9f/app/src/main/res/drawable/travel.jpeg -------------------------------------------------------------------------------- /app/src/main/res/drawable/travel_grid_background_shape.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 9 | 10 | 11 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/travel_the_world_stock_hd_wallpaper.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yudiz-solutions/material-design-android/12421dbdb5c1c84195d91021a043053d9a28ee9f/app/src/main/res/drawable/travel_the_world_stock_hd_wallpaper.jpg -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_back_drop.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 16 | 17 | 18 | 19 | 20 | 24 | 25 | 39 | 40 | 41 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_bottom_app_behaviour.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 12 | 13 | 22 | 23 | 27 | 28 | 29 | 30 | 31 | 32 | 49 | 50 | 58 | 59 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_login.xml: -------------------------------------------------------------------------------- 1 | 2 | 12 | 13 | 22 | 23 | 24 | 30 | 31 | 41 | 42 | 47 | 48 | 53 | 54 | 55 | 62 | 63 | 68 | 69 | 70 | 76 | 77 | 85 | 86 | 96 | 97 | 98 | 99 | 100 | 101 | -------------------------------------------------------------------------------- /app/src/main/res/layout/content_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 10 | 11 | 15 | 16 | 20 | 21 | 31 | 32 |