diff --git a/app/build.gradle b/app/build.gradle index 2ddd84d..f50814e 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -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 @@ -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' diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index a81583d..342c7f2 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -1,7 +1,6 @@ - (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() + + binding.bnvMain.setOnItemSelectedListener { menu -> + when (menu.itemId) { + R.id.menu_main_home -> navigateTo() + R.id.menu_main_explore -> navigateTo() + R.id.menu_main_like -> navigateTo() + R.id.menu_main_setting -> navigateTo() + } + true + } + } + + private inline fun navigateTo() { + supportFragmentManager.commit { + replace(R.id.fcv_main, T::class.java.canonicalName) + } } } diff --git a/app/src/main/java/com/release/keyneez/presentation/main/explore/ExploreFragment.kt b/app/src/main/java/com/release/keyneez/presentation/main/explore/ExploreFragment.kt new file mode 100644 index 0000000..7a3868d --- /dev/null +++ b/app/src/main/java/com/release/keyneez/presentation/main/explore/ExploreFragment.kt @@ -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(R.layout.fragment_explore) { + + companion object { + fun newInstance() = ExploreFragment() + } +} diff --git a/app/src/main/java/com/release/keyneez/presentation/main/home/HomeFragment.kt b/app/src/main/java/com/release/keyneez/presentation/main/home/HomeFragment.kt new file mode 100644 index 0000000..bd22949 --- /dev/null +++ b/app/src/main/java/com/release/keyneez/presentation/main/home/HomeFragment.kt @@ -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(R.layout.fragment_home) { + + companion object { + fun newInstance() = HomeFragment() + } +} diff --git a/app/src/main/java/com/release/keyneez/presentation/main/like/LikeFragment.kt b/app/src/main/java/com/release/keyneez/presentation/main/like/LikeFragment.kt new file mode 100644 index 0000000..1205030 --- /dev/null +++ b/app/src/main/java/com/release/keyneez/presentation/main/like/LikeFragment.kt @@ -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(R.layout.fragment_like) { + + companion object { + fun newInstance() = LikeFragment() + } +} diff --git a/app/src/main/java/com/release/keyneez/presentation/main/setting/SettingFragment.kt b/app/src/main/java/com/release/keyneez/presentation/main/setting/SettingFragment.kt new file mode 100644 index 0000000..21e303c --- /dev/null +++ b/app/src/main/java/com/release/keyneez/presentation/main/setting/SettingFragment.kt @@ -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(R.layout.fragment_setting) { + + companion object { + fun newInstance() = SettingFragment() + } +} diff --git a/app/src/main/java/com/release/keyneez/util/binding/BindingFragment.kt b/app/src/main/java/com/release/keyneez/util/binding/BindingFragment.kt index 143b4f9..1171719 100644 --- a/app/src/main/java/com/release/keyneez/util/binding/BindingFragment.kt +++ b/app/src/main/java/com/release/keyneez/util/binding/BindingFragment.kt @@ -11,15 +11,15 @@ import androidx.fragment.app.Fragment import com.release.keyneez.R abstract class BindingFragment( - @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 diff --git a/app/src/main/java/com/release/keyneez/util/extension/ContextExt.kt b/app/src/main/java/com/release/keyneez/util/extension/ContextExt.kt index 573efce..dd2e72f 100644 --- a/app/src/main/java/com/release/keyneez/util/extension/ContextExt.kt +++ b/app/src/main/java/com/release/keyneez/util/extension/ContextExt.kt @@ -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() -} diff --git a/app/src/main/java/com/release/keyneez/util/extension/ViewExt.kt b/app/src/main/java/com/release/keyneez/util/extension/ViewExt.kt index 70fc8c1..94f2591 100644 --- a/app/src/main/java/com/release/keyneez/util/extension/ViewExt.kt +++ b/app/src/main/java/com/release/keyneez/util/extension/ViewExt.kt @@ -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) }) } diff --git a/app/src/main/res/drawable/ic_main_explore_empty.xml b/app/src/main/res/drawable/ic_main_explore_empty.xml new file mode 100644 index 0000000..45c4180 --- /dev/null +++ b/app/src/main/res/drawable/ic_main_explore_empty.xml @@ -0,0 +1,18 @@ + + + + + + diff --git a/app/src/main/res/drawable/ic_main_explore_fill.xml b/app/src/main/res/drawable/ic_main_explore_fill.xml new file mode 100644 index 0000000..5b8c7c1 --- /dev/null +++ b/app/src/main/res/drawable/ic_main_explore_fill.xml @@ -0,0 +1,18 @@ + + + + + + diff --git a/app/src/main/res/drawable/ic_main_home_empty.xml b/app/src/main/res/drawable/ic_main_home_empty.xml new file mode 100644 index 0000000..b4e4080 --- /dev/null +++ b/app/src/main/res/drawable/ic_main_home_empty.xml @@ -0,0 +1,9 @@ + + + diff --git a/app/src/main/res/drawable/ic_main_home_fill.xml b/app/src/main/res/drawable/ic_main_home_fill.xml new file mode 100644 index 0000000..d9c2c33 --- /dev/null +++ b/app/src/main/res/drawable/ic_main_home_fill.xml @@ -0,0 +1,9 @@ + + + diff --git a/app/src/main/res/drawable/ic_main_like_empty.xml b/app/src/main/res/drawable/ic_main_like_empty.xml new file mode 100644 index 0000000..9187b31 --- /dev/null +++ b/app/src/main/res/drawable/ic_main_like_empty.xml @@ -0,0 +1,9 @@ + + + diff --git a/app/src/main/res/drawable/ic_main_like_fill.xml b/app/src/main/res/drawable/ic_main_like_fill.xml new file mode 100644 index 0000000..e5c3f70 --- /dev/null +++ b/app/src/main/res/drawable/ic_main_like_fill.xml @@ -0,0 +1,9 @@ + + + diff --git a/app/src/main/res/drawable/ic_main_setting_empty.xml b/app/src/main/res/drawable/ic_main_setting_empty.xml new file mode 100644 index 0000000..44b1463 --- /dev/null +++ b/app/src/main/res/drawable/ic_main_setting_empty.xml @@ -0,0 +1,10 @@ + + + diff --git a/app/src/main/res/drawable/ic_main_setting_fill.xml b/app/src/main/res/drawable/ic_main_setting_fill.xml new file mode 100644 index 0000000..75ce1a0 --- /dev/null +++ b/app/src/main/res/drawable/ic_main_setting_fill.xml @@ -0,0 +1,10 @@ + + + diff --git a/app/src/main/res/drawable/sel_main_color_bnv_menu.xml b/app/src/main/res/drawable/sel_main_color_bnv_menu.xml new file mode 100644 index 0000000..7c1b153 --- /dev/null +++ b/app/src/main/res/drawable/sel_main_color_bnv_menu.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/sel_main_drawable_bnv_explore_icon.xml b/app/src/main/res/drawable/sel_main_drawable_bnv_explore_icon.xml new file mode 100644 index 0000000..cf137f2 --- /dev/null +++ b/app/src/main/res/drawable/sel_main_drawable_bnv_explore_icon.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/sel_main_drawable_bnv_home_icon.xml b/app/src/main/res/drawable/sel_main_drawable_bnv_home_icon.xml new file mode 100644 index 0000000..38d13a9 --- /dev/null +++ b/app/src/main/res/drawable/sel_main_drawable_bnv_home_icon.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/sel_main_drawable_bnv_like_icon.xml b/app/src/main/res/drawable/sel_main_drawable_bnv_like_icon.xml new file mode 100644 index 0000000..96c5cad --- /dev/null +++ b/app/src/main/res/drawable/sel_main_drawable_bnv_like_icon.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/sel_main_drawable_bnv_setting_icon.xml b/app/src/main/res/drawable/sel_main_drawable_bnv_setting_icon.xml new file mode 100644 index 0000000..0c438fc --- /dev/null +++ b/app/src/main/res/drawable/sel_main_drawable_bnv_setting_icon.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/shape_white_fill_rect_topshadow.xml b/app/src/main/res/drawable/shape_white_fill_rect_topshadow.xml new file mode 100644 index 0000000..9a745d5 --- /dev/null +++ b/app/src/main/res/drawable/shape_white_fill_rect_topshadow.xml @@ -0,0 +1,131 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/font/font_pretendard_regular.xml b/app/src/main/res/font/font_pretendard_regular.xml new file mode 100644 index 0000000..320f63a --- /dev/null +++ b/app/src/main/res/font/font_pretendard_regular.xml @@ -0,0 +1,7 @@ + + + + \ No newline at end of file diff --git a/app/src/main/res/font/pretendard_regular.otf b/app/src/main/res/font/pretendard_regular.otf new file mode 100644 index 0000000..c940185 Binary files /dev/null and b/app/src/main/res/font/pretendard_regular.otf differ diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml index 435ca35..60b6faa 100644 --- a/app/src/main/res/layout/activity_main.xml +++ b/app/src/main/res/layout/activity_main.xml @@ -1,18 +1,45 @@ - - + - \ No newline at end of file + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_explore.xml b/app/src/main/res/layout/fragment_explore.xml new file mode 100644 index 0000000..e0bfd24 --- /dev/null +++ b/app/src/main/res/layout/fragment_explore.xml @@ -0,0 +1,20 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_home.xml b/app/src/main/res/layout/fragment_home.xml new file mode 100644 index 0000000..2d83732 --- /dev/null +++ b/app/src/main/res/layout/fragment_home.xml @@ -0,0 +1,16 @@ + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_like.xml b/app/src/main/res/layout/fragment_like.xml new file mode 100644 index 0000000..e553368 --- /dev/null +++ b/app/src/main/res/layout/fragment_like.xml @@ -0,0 +1,16 @@ + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_setting.xml b/app/src/main/res/layout/fragment_setting.xml new file mode 100644 index 0000000..6b609ff --- /dev/null +++ b/app/src/main/res/layout/fragment_setting.xml @@ -0,0 +1,16 @@ + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/menu/menu_main.xml b/app/src/main/res/menu/menu_main.xml new file mode 100644 index 0000000..c9bf14b --- /dev/null +++ b/app/src/main/res/menu/menu_main.xml @@ -0,0 +1,19 @@ + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/values/appearances.xml b/app/src/main/res/values/appearances.xml index a0683a9..e06eabf 100644 --- a/app/src/main/res/values/appearances.xml +++ b/app/src/main/res/values/appearances.xml @@ -3,7 +3,6 @@ - + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 5b2b045..1f3a332 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -1,10 +1,16 @@ Keyneez - // common + Binding not initialized to reference the view. - // search + + + 탐색 + 좋아요 + 설정 + + 제목, 키워드 검색결과 %s개 diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml new file mode 100644 index 0000000..bfa19e8 --- /dev/null +++ b/app/src/main/res/values/styles.xml @@ -0,0 +1,7 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/res/values/themes.xml b/app/src/main/res/values/themes.xml index 383a9af..7404dfa 100644 --- a/app/src/main/res/values/themes.xml +++ b/app/src/main/res/values/themes.xml @@ -17,6 +17,7 @@ @color/red500 ?colorPrimaryVariant + true false