Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
 into feature/#23-ui-signup-layout
  • Loading branch information
etama123 committed May 18, 2023
2 parents 5672e90 + 9e20db6 commit d137776
Show file tree
Hide file tree
Showing 36 changed files with 531 additions and 62 deletions.
10 changes: 9 additions & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,20 @@ android {
}

dependencies {
// constraint layout
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'

// hilt
implementation "com.google.dagger:hilt-android:2.46"
kapt "com.google.dagger:hilt-compiler:2.46"

// hilt
implementation "com.google.dagger:hilt-android:2.46"
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
kapt "com.google.dagger:hilt-compiler:2.46"

// ktx
implementation 'androidx.core:core-ktx:1.10.1'
implementation "androidx.fragment:fragment-ktx:1.5.7"

// recyclerview
Expand Down Expand Up @@ -102,7 +110,7 @@ dependencies {
implementation 'androidx.appcompat:appcompat:1.6.1'

// material
implementation 'com.google.android.material:material:1.8.0'
implementation 'com.google.android.material:material:1.9.0'

// constraint layout
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
Expand Down
1 change: 0 additions & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">

<uses-permission android:name="android.permission.INTERNET" />

<application
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,41 @@
package com.release.keyneez.presentation.main

import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import com.kakao.sdk.common.util.Utility
import androidx.fragment.app.Fragment
import androidx.fragment.app.commit
import androidx.fragment.app.replace
import com.release.keyneez.R
import timber.log.Timber
import com.release.keyneez.databinding.ActivityMainBinding
import com.release.keyneez.presentation.main.explore.ExploreFragment
import com.release.keyneez.presentation.main.home.HomeFragment
import com.release.keyneez.presentation.main.like.LikeFragment
import com.release.keyneez.presentation.main.setting.SettingFragment
import com.release.keyneez.util.binding.BindingActivity

class MainActivity : AppCompatActivity() {
class MainActivity : BindingActivity<ActivityMainBinding>(R.layout.activity_main) {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)

val keyHash = Utility.getKeyHash(this)
Timber.tag("Hash").d(keyHash)
initBnvItemSelectedListener()
}

private fun initBnvItemSelectedListener() {
supportFragmentManager.findFragmentById(R.id.fcv_main) ?: navigateTo<HomeFragment>()

binding.bnvMain.setOnItemSelectedListener { menu ->
when (menu.itemId) {
R.id.menu_main_home -> navigateTo<HomeFragment>()
R.id.menu_main_explore -> navigateTo<ExploreFragment>()
R.id.menu_main_like -> navigateTo<LikeFragment>()
R.id.menu_main_setting -> navigateTo<SettingFragment>()
}
true
}
}

private inline fun <reified T : Fragment> navigateTo() {
supportFragmentManager.commit {
replace<T>(R.id.fcv_main, T::class.java.canonicalName)
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package com.release.keyneez.presentation.main.explore

import com.release.keyneez.R
import com.release.keyneez.databinding.FragmentExploreBinding
import com.release.keyneez.util.binding.BindingFragment

class ExploreFragment : BindingFragment<FragmentExploreBinding>(R.layout.fragment_explore) {

companion object {
fun newInstance() = ExploreFragment()
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package com.release.keyneez.presentation.main.home

import com.release.keyneez.R
import com.release.keyneez.databinding.FragmentHomeBinding
import com.release.keyneez.util.binding.BindingFragment

class HomeFragment : BindingFragment<FragmentHomeBinding>(R.layout.fragment_home) {

companion object {
fun newInstance() = HomeFragment()
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package com.release.keyneez.presentation.main.like

import com.release.keyneez.R
import com.release.keyneez.databinding.FragmentLikeBinding
import com.release.keyneez.util.binding.BindingFragment

class LikeFragment : BindingFragment<FragmentLikeBinding>(R.layout.fragment_like) {

companion object {
fun newInstance() = LikeFragment()
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package com.release.keyneez.presentation.main.setting

import com.release.keyneez.R
import com.release.keyneez.databinding.FragmentSettingBinding
import com.release.keyneez.util.binding.BindingFragment

class SettingFragment : BindingFragment<FragmentSettingBinding>(R.layout.fragment_setting) {

companion object {
fun newInstance() = SettingFragment()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@ import androidx.fragment.app.Fragment
import com.release.keyneez.R

abstract class BindingFragment<T : ViewDataBinding>(
@LayoutRes private val layoutRes: Int
@LayoutRes private val layoutRes: Int,
) : Fragment() {
private var _binding: T? = null
protected val binding get() = _binding ?: error(getString(R.string.binding_error))
protected val binding get() = requireNotNull(_binding) { getString(R.string.binding_error) }

override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
savedInstanceState: Bundle?,
): View? {
_binding = DataBindingUtil.inflate(inflater, layoutRes, container, false)
binding.lifecycleOwner = viewLifecycleOwner
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,3 @@ fun Context.showSnackbar(view: View, msg: String) {
fun Context.showToast(msg: String) {
Toast.makeText(this, msg, Toast.LENGTH_SHORT).show()
}

fun Context.dpToPx(dp: Int): Int {
val scale = resources.displayMetrics.density
return (dp * scale).toInt()
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import com.google.android.material.snackbar.Snackbar
import com.release.keyneez.util.OnSingleClickListener

/** Register a callback to be invoked when this view is clicked. If this view was clicked within 1 second, the callback will not be invoked. */
fun View.setOnSingleClickListener(onSingleClick: (View) -> Unit) {
inline fun View.setOnSingleClickListener(crossinline onSingleClick: (View) -> Unit) {
setOnClickListener(OnSingleClickListener { onSingleClick(it) })
}

Expand Down
18 changes: 18 additions & 0 deletions app/src/main/res/drawable/ic_main_explore_empty.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="34dp"
android:height="34dp"
android:viewportWidth="34"
android:viewportHeight="34">
<path
android:pathData="M3.514,17.207C2.153,14.354 3.486,10.945 6.421,9.772V9.772C9.356,8.599 12.672,10.151 13.652,13.156L15.651,19.288C15.919,20.112 15.502,21.003 14.697,21.325L8.385,23.847C7.58,24.169 6.664,23.81 6.291,23.028L3.514,17.207Z"
android:fillColor="#ADADAD"/>
<path
android:pathData="M8.286,27.316C9.265,29.766 12.044,30.958 14.494,29.979V29.979C16.944,29 18.136,26.221 17.157,23.771L16.862,23.032C16.699,22.624 16.235,22.425 15.827,22.588L8.435,25.542C8.026,25.705 7.828,26.169 7.991,26.577L8.286,27.316Z"
android:fillColor="#ADADAD"/>
<path
android:pathData="M21.115,7.728C21.726,4.626 24.831,2.687 27.886,3.499V3.499C30.941,4.31 32.675,7.535 31.666,10.531L29.609,16.642C29.333,17.464 28.466,17.93 27.628,17.708L21.059,15.962C20.221,15.74 19.7,14.905 19.868,14.055L21.115,7.728Z"
android:fillColor="#ADADAD"/>
<path
android:pathData="M18.911,18.686C18.234,21.235 19.752,23.851 22.301,24.528V24.528C24.851,25.206 27.467,23.688 28.144,21.139L28.348,20.369C28.461,19.944 28.208,19.508 27.783,19.395L20.089,17.351C19.664,17.239 19.228,17.492 19.116,17.917L18.911,18.686Z"
android:fillColor="#ADADAD"/>
</vector>
18 changes: 18 additions & 0 deletions app/src/main/res/drawable/ic_main_explore_fill.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="34dp"
android:height="34dp"
android:viewportWidth="34"
android:viewportHeight="34">
<path
android:pathData="M3.514,17.207C2.153,14.354 3.486,10.945 6.421,9.772V9.772C9.356,8.599 12.672,10.151 13.652,13.156L15.651,19.288C15.919,20.112 15.502,21.003 14.697,21.325L8.385,23.847C7.58,24.169 6.664,23.81 6.291,23.028L3.514,17.207Z"
android:fillColor="#000000"/>
<path
android:pathData="M8.286,27.316C9.265,29.766 12.044,30.958 14.494,29.979V29.979C16.944,29 18.136,26.221 17.157,23.771L16.862,23.032C16.699,22.624 16.235,22.425 15.827,22.588L8.435,25.542C8.026,25.705 7.828,26.169 7.991,26.577L8.286,27.316Z"
android:fillColor="#000000"/>
<path
android:pathData="M21.115,7.728C21.726,4.626 24.831,2.687 27.886,3.499V3.499C30.941,4.31 32.675,7.535 31.666,10.531L29.609,16.642C29.333,17.464 28.466,17.93 27.628,17.708L21.059,15.962C20.221,15.74 19.7,14.905 19.868,14.055L21.115,7.728Z"
android:fillColor="#000000"/>
<path
android:pathData="M18.911,18.686C18.234,21.235 19.752,23.851 22.301,24.528V24.528C24.851,25.206 27.467,23.688 28.144,21.139L28.348,20.369C28.461,19.944 28.208,19.508 27.783,19.395L20.089,17.351C19.664,17.239 19.228,17.492 19.116,17.917L18.911,18.686Z"
android:fillColor="#000000"/>
</vector>
9 changes: 9 additions & 0 deletions app/src/main/res/drawable/ic_main_home_empty.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="34dp"
android:height="34dp"
android:viewportWidth="34"
android:viewportHeight="34">
<path
android:pathData="M8.938,28.5C8.399,28.5 7.942,28.306 7.565,27.917C7.188,27.528 7,27.056 7,26.5V13.5C7,13.189 7.07,12.889 7.21,12.6C7.35,12.311 7.538,12.078 7.775,11.9L16.171,5.4C16.343,5.267 16.526,5.167 16.72,5.1C16.913,5.033 17.118,5 17.333,5C17.549,5 17.753,5.033 17.947,5.1C18.141,5.167 18.324,5.267 18.496,5.4L26.892,11.9C27.128,12.078 27.317,12.311 27.457,12.6C27.597,12.889 27.667,13.189 27.667,13.5V26.5C27.667,27.056 27.478,27.528 27.102,27.917C26.725,28.306 26.267,28.5 25.729,28.5H19.917V19.167H14.75V28.5H8.938Z"
android:fillColor="#ADADAD"/>
</vector>
9 changes: 9 additions & 0 deletions app/src/main/res/drawable/ic_main_home_fill.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="34dp"
android:height="34dp"
android:viewportWidth="34"
android:viewportHeight="34">
<path
android:pathData="M8.938,28.5C8.399,28.5 7.942,28.306 7.565,27.917C7.188,27.528 7,27.056 7,26.5V13.5C7,13.189 7.07,12.889 7.21,12.6C7.35,12.311 7.538,12.078 7.775,11.9L16.171,5.4C16.343,5.267 16.526,5.167 16.72,5.1C16.913,5.033 17.118,5 17.333,5C17.549,5 17.753,5.033 17.947,5.1C18.141,5.167 18.324,5.267 18.496,5.4L26.892,11.9C27.128,12.078 27.317,12.311 27.457,12.6C27.597,12.889 27.667,13.189 27.667,13.5V26.5C27.667,27.056 27.478,27.528 27.102,27.917C26.725,28.306 26.267,28.5 25.729,28.5H19.917V19.167H14.75V28.5H8.938Z"
android:fillColor="#000000"/>
</vector>
9 changes: 9 additions & 0 deletions app/src/main/res/drawable/ic_main_like_empty.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="34dp"
android:height="34dp"
android:viewportWidth="34"
android:viewportHeight="34">
<path
android:pathData="M15.667,27.507L13.945,25.997C11.258,23.635 8.929,21.381 6.957,19.234C4.986,17.087 4,14.843 4,12.501C4,10.653 4.655,9.107 5.966,7.864C7.277,6.621 8.897,6 10.825,6C11.93,6 13.024,6.252 14.108,6.755C15.191,7.258 16.155,8.085 17,9.235C17.953,8.085 18.939,7.258 19.958,6.755C20.976,6.252 22.048,6 23.175,6C25.103,6 26.723,6.621 28.034,7.864C29.345,9.107 30,10.653 30,12.501C30,14.843 29.014,17.087 27.042,19.234C25.071,21.381 22.742,23.635 20.055,25.997L18.333,27.507C17.964,27.836 17.52,28 17,28C16.48,28 16.036,27.836 15.667,27.507Z"
android:fillColor="#ADADAD"/>
</vector>
9 changes: 9 additions & 0 deletions app/src/main/res/drawable/ic_main_like_fill.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="34dp"
android:height="34dp"
android:viewportWidth="34"
android:viewportHeight="34">
<path
android:pathData="M15.667,27.507L13.945,25.997C11.258,23.635 8.929,21.381 6.957,19.234C4.986,17.087 4,14.843 4,12.501C4,10.653 4.655,9.107 5.966,7.864C7.277,6.621 8.897,6 10.825,6C11.93,6 13.024,6.252 14.108,6.755C15.191,7.258 16.155,8.085 17,9.235C17.953,8.085 18.939,7.258 19.958,6.755C20.976,6.252 22.048,6 23.175,6C25.103,6 26.723,6.621 28.034,7.864C29.345,9.107 30,10.653 30,12.501C30,14.843 29.014,17.087 27.042,19.234C25.071,21.381 22.742,23.635 20.055,25.997L18.333,27.507C17.964,27.836 17.52,28 17,28C16.48,28 16.036,27.836 15.667,27.507Z"
android:fillColor="#000000"/>
</vector>
10 changes: 10 additions & 0 deletions app/src/main/res/drawable/ic_main_setting_empty.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="34dp"
android:height="34dp"
android:viewportWidth="34"
android:viewportHeight="34">
<path
android:pathData="M4.101,21.268L6.775,25.753C6.953,26.035 7.287,26.143 7.599,26.035L10.92,24.735C11.611,25.255 12.346,25.688 13.17,26.013L13.661,29.458C13.728,29.762 13.995,30 14.329,30H19.678C20.012,30 20.279,29.762 20.346,29.437L20.836,25.992C21.639,25.667 22.396,25.233 23.087,24.713L26.408,26.013C26.719,26.122 27.054,26.013 27.232,25.732L29.906,21.247C30.084,20.965 29.995,20.618 29.75,20.402L26.92,18.257C26.987,17.845 27.009,17.412 27.009,17C27.009,16.586 26.969,16.192 26.926,15.781C26.924,15.761 26.922,15.741 26.92,15.722L29.75,13.577C29.995,13.382 30.084,13.013 29.906,12.732L27.232,8.247C27.054,7.965 26.719,7.857 26.408,7.965L23.087,9.265C22.396,8.745 21.661,8.312 20.836,7.987L20.346,4.542C20.279,4.238 20.012,4 19.678,4H14.329C13.995,4 13.728,4.238 13.661,4.563L13.17,8.008C12.368,8.333 11.588,8.745 10.92,9.265L7.599,7.965C7.287,7.857 6.953,7.965 6.775,8.247L4.101,12.732C3.922,13.013 4.012,13.36 4.257,13.577L7.087,15.722C7.02,16.155 6.975,16.567 6.975,17C6.975,17.414 7.016,17.808 7.058,18.219C7.061,18.239 7.063,18.259 7.065,18.278L4.234,20.423C3.989,20.64 3.922,20.987 4.101,21.268ZM17.003,13.295C19.098,13.295 20.814,14.963 20.814,17C20.814,19.037 19.098,20.705 17.003,20.705C14.908,20.705 13.192,19.037 13.192,17C13.192,14.963 14.908,13.295 17.003,13.295Z"
android:fillColor="#ADADAD"
android:fillType="evenOdd"/>
</vector>
10 changes: 10 additions & 0 deletions app/src/main/res/drawable/ic_main_setting_fill.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="34dp"
android:height="34dp"
android:viewportWidth="34"
android:viewportHeight="34">
<path
android:pathData="M4.101,21.268L6.775,25.753C6.953,26.035 7.287,26.143 7.599,26.035L10.92,24.735C11.611,25.255 12.346,25.688 13.17,26.013L13.661,29.458C13.728,29.762 13.995,30 14.329,30H19.678C20.012,30 20.279,29.762 20.346,29.437L20.836,25.992C21.639,25.667 22.396,25.233 23.087,24.713L26.408,26.013C26.719,26.122 27.054,26.013 27.232,25.732L29.906,21.247C30.084,20.965 29.995,20.618 29.75,20.402L26.92,18.257C26.987,17.845 27.009,17.412 27.009,17C27.009,16.586 26.969,16.192 26.926,15.781C26.924,15.761 26.922,15.741 26.92,15.722L29.75,13.577C29.995,13.382 30.084,13.013 29.906,12.732L27.232,8.247C27.054,7.965 26.719,7.857 26.408,7.965L23.087,9.265C22.396,8.745 21.661,8.312 20.836,7.987L20.346,4.542C20.279,4.238 20.012,4 19.678,4H14.329C13.995,4 13.728,4.238 13.661,4.563L13.17,8.008C12.368,8.333 11.588,8.745 10.92,9.265L7.599,7.965C7.287,7.857 6.953,7.965 6.775,8.247L4.101,12.732C3.922,13.013 4.012,13.36 4.257,13.577L7.087,15.722C7.02,16.155 6.975,16.567 6.975,17C6.975,17.414 7.016,17.808 7.058,18.219C7.061,18.239 7.063,18.259 7.065,18.278L4.234,20.423C3.989,20.64 3.922,20.987 4.101,21.268ZM17.003,13.295C19.098,13.295 20.814,14.963 20.814,17C20.814,19.037 19.098,20.705 17.003,20.705C14.908,20.705 13.192,19.037 13.192,17C13.192,14.963 14.908,13.295 17.003,13.295Z"
android:fillColor="#000000"
android:fillType="evenOdd"/>
</vector>
5 changes: 5 additions & 0 deletions app/src/main/res/drawable/sel_main_color_bnv_menu.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:color="@color/gray900" android:state_selected="true" />
<item android:color="@color/gray400" android:state_selected="false" />
</selector>
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/ic_main_explore_empty" android:state_checked="false" />
<item android:drawable="@drawable/ic_main_explore_fill" android:state_checked="true" />
</selector>
5 changes: 5 additions & 0 deletions app/src/main/res/drawable/sel_main_drawable_bnv_home_icon.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/ic_main_home_empty" android:state_checked="false" />
<item android:drawable="@drawable/ic_main_home_fill" android:state_checked="true" />
</selector>
5 changes: 5 additions & 0 deletions app/src/main/res/drawable/sel_main_drawable_bnv_like_icon.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/ic_main_like_empty" android:state_checked="false" />
<item android:drawable="@drawable/ic_main_like_fill" android:state_checked="true" />
</selector>
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/ic_main_setting_empty" android:state_checked="false" />
<item android:drawable="@drawable/ic_main_setting_fill" android:state_checked="true" />
</selector>
Loading

0 comments on commit d137776

Please sign in to comment.