-
Notifications
You must be signed in to change notification settings - Fork 0
220710_검색창 UI구현 #2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| package com.android.project.weather.ui | ||
|
|
||
| import android.os.Bundle | ||
| import android.view.LayoutInflater | ||
| import android.view.View | ||
| import android.view.ViewGroup | ||
| import androidx.fragment.app.Fragment | ||
| import com.android.project.weather.databinding.FragmentSearchBinding | ||
|
|
||
| class SearchFragment: Fragment() { | ||
| lateinit var binding:FragmentSearchBinding | ||
|
|
||
| override fun onCreateView( | ||
| inflater: LayoutInflater, | ||
| container: ViewGroup?, | ||
| savedInstanceState: Bundle? | ||
| ): View? { | ||
| binding = FragmentSearchBinding.inflate(inflater, container, false) | ||
|
|
||
| return binding.root | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| package com.android.project.weather.ui | ||
|
|
||
| import android.os.Bundle | ||
| import android.util.Log | ||
| import android.view.LayoutInflater | ||
| import android.view.View | ||
| import android.view.ViewGroup | ||
| import androidx.fragment.app.Fragment | ||
| import com.android.project.weather.databinding.FragmentSearchResultBinding | ||
|
|
||
|
|
||
| class SearchResultFragment: Fragment() { | ||
| lateinit var binding:FragmentSearchResultBinding | ||
|
|
||
| override fun onCreateView( | ||
| inflater: LayoutInflater, | ||
| container: ViewGroup?, | ||
| savedInstanceState: Bundle? | ||
| ): View? { | ||
| binding = FragmentSearchResultBinding.inflate(inflater, container, false) | ||
|
|
||
| var bundle = arguments | ||
| Log.d("SearchFragment", "번들값: " + bundle?.getString("keyword")) | ||
| if(bundle != null) | ||
| binding.tvKeyword.text = "'" + bundle.getString("keyword") + "'" | ||
|
|
||
| return binding.root | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,10 +1,13 @@ | ||
| package com.android.project.weather.ui | ||
|
|
||
| import android.os.Bundle | ||
| import android.util.Log | ||
| import android.view.KeyEvent | ||
| import android.view.LayoutInflater | ||
| import android.view.View | ||
| import android.view.ViewGroup | ||
| import androidx.fragment.app.Fragment | ||
| import com.android.project.weather.R | ||
| import com.android.project.weather.databinding.FragmentTwoBinding | ||
|
|
||
| class TwoFragment: Fragment() { | ||
|
|
@@ -17,6 +20,41 @@ class TwoFragment: Fragment() { | |
| ): View? { | ||
| binding = FragmentTwoBinding.inflate(inflater, container, false) | ||
|
|
||
| //하단 프래그먼트 초기설정 | ||
| childFragmentManager.beginTransaction() | ||
| .replace(R.id.frame_search, SearchFragment()) | ||
| .commitAllowingStateLoss() | ||
|
|
||
| //키워드 검색 후 엔터눌렀을 때 하단 프래그먼트 변경 | ||
| binding.etSearch.setOnKeyListener{ _, keyCode, event -> | ||
| if((event.action == KeyEvent.ACTION_DOWN) && (keyCode == KeyEvent.KEYCODE_ENTER)){ | ||
| //검색 키워드 번들로 전달 | ||
| Log.d("SearchFragment", "엔터 전" + binding.etSearch.text.toString()) | ||
|
|
||
| var bundle:Bundle = Bundle(1) | ||
| bundle.putString("keyword", binding.etSearch.text.toString()) | ||
|
|
||
| val srf = SearchResultFragment() | ||
| srf.arguments = bundle | ||
|
|
||
| childFragmentManager.beginTransaction() | ||
| .replace(R.id.frame_search, srf) | ||
| .commitAllowingStateLoss() | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 저 이거 설명해주세요 ..... 난 commit 밖에 몰라 ... |
||
|
|
||
| true | ||
| }else{ | ||
|
|
||
| false | ||
| } | ||
| } | ||
|
|
||
| //취소 터치 시, 원래 프래그먼트로 | ||
| binding.btnCancel.setOnClickListener{ | ||
| childFragmentManager.beginTransaction() | ||
| .replace(R.id.frame_search, SearchFragment()) | ||
| .commitAllowingStateLoss() | ||
| } | ||
|
|
||
| return binding.root | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| <?xml version="1.0" encoding="utf-8"?> | ||
| <layer-list xmlns:android="http://schemas.android.com/apk/res/android"> | ||
| <item> | ||
| <shape android:shape="rectangle"> | ||
| <solid android:color="@color/white"/> | ||
| <corners | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 네 개의 radius 값이 다 같다면 ... 한 줄로 줄일 수 있는 방법은 ? |
||
| android:bottomRightRadius="15dp" | ||
| android:bottomLeftRadius="15dp" | ||
| android:topLeftRadius="15dp" | ||
| android:topRightRadius="15dp"/> | ||
| </shape> | ||
| </item> | ||
| </layer-list> | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| <vector android:alpha="0.7" android:height="20dp" android:tint="#AAAAAA" | ||
| android:viewportHeight="24" android:viewportWidth="24" | ||
| android:width="20dp" xmlns:android="http://schemas.android.com/apk/res/android"> | ||
| <path android:fillColor="@android:color/white" android:pathData="M15.5,14h-0.79l-0.28,-0.27C15.41,12.59 16,11.11 16,9.5 16,5.91 13.09,3 9.5,3S3,5.91 3,9.5 5.91,16 9.5,16c1.61,0 3.09,-0.59 4.23,-1.57l0.27,0.28v0.79l5,4.99L20.49,19l-4.99,-5zM9.5,14C7.01,14 5,11.99 5,9.5S7.01,5 9.5,5 14,7.01 14,9.5 11.99,14 9.5,14z"/> | ||
| </vector> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,102 @@ | ||
| <?xml version="1.0" encoding="utf-8"?> | ||
| <androidx.constraintlayout.widget.ConstraintLayout | ||
| xmlns:android="http://schemas.android.com/apk/res/android" | ||
| android:layout_width="match_parent" | ||
| android:layout_height="match_parent" | ||
| xmlns:app="http://schemas.android.com/apk/res-auto"> | ||
|
|
||
| <androidx.constraintlayout.widget.ConstraintLayout | ||
| android:id="@+id/constraint_popular_keyword" | ||
| android:layout_width="match_parent" | ||
| android:layout_height="wrap_content" | ||
| android:background="@color/weather_main" | ||
| app:layout_constraintStart_toStartOf="parent" | ||
| app:layout_constraintTop_toTopOf="parent" | ||
| app:layout_constraintEnd_toEndOf="parent" | ||
| android:paddingTop="6dp" | ||
| android:layout_marginBottom="16dp" | ||
| android:paddingHorizontal="28dp"> | ||
|
|
||
| <TextView | ||
| android:id="@+id/tv_popular_keyword" | ||
| android:layout_width="wrap_content" | ||
| android:layout_height="wrap_content" | ||
| android:text="실시간 인기 검색어" | ||
| android:textSize="14sp" | ||
| android:textColor="@color/white" | ||
| app:layout_constraintStart_toStartOf="parent" | ||
| app:layout_constraintTop_toTopOf="parent"/> | ||
|
|
||
| <LinearLayout | ||
| android:layout_width="match_parent" | ||
| android:layout_height="wrap_content" | ||
| android:orientation="horizontal" | ||
| android:layout_marginVertical="16dp" | ||
| app:layout_constraintStart_toStartOf="parent" | ||
| app:layout_constraintEnd_toEndOf="parent" | ||
| app:layout_constraintTop_toBottomOf="@id/tv_popular_keyword"> | ||
|
|
||
| <LinearLayout | ||
| android:layout_width="0dp" | ||
| android:layout_height="wrap_content" | ||
| android:layout_marginVertical="6dp" | ||
| android:layout_weight="1" | ||
| android:orientation="vertical"> | ||
|
|
||
| <TextView | ||
| android:layout_width="wrap_content" | ||
| android:layout_height="wrap_content" | ||
| android:textColor="@color/white" | ||
| android:text="1 자켓"/> | ||
| <TextView | ||
| android:layout_width="wrap_content" | ||
| android:layout_height="wrap_content" | ||
| android:textColor="@color/white" | ||
| android:text="2 자켓"/> | ||
| <TextView | ||
| android:layout_width="wrap_content" | ||
| android:layout_height="wrap_content" | ||
| android:textColor="@color/white" | ||
| android:text="3 자켓"/> | ||
| </LinearLayout> | ||
| <LinearLayout | ||
| android:layout_width="0dp" | ||
| android:layout_height="wrap_content" | ||
| android:layout_weight="1" | ||
| android:layout_marginVertical="6dp" | ||
| android:orientation="vertical"> | ||
| <TextView | ||
| android:layout_width="wrap_content" | ||
| android:layout_height="wrap_content" | ||
| android:textColor="@color/white" | ||
| android:text="1 자켓"/> | ||
|
|
||
| <TextView | ||
| android:layout_width="wrap_content" | ||
| android:layout_height="wrap_content" | ||
| android:textColor="@color/white" | ||
| android:text="1 자켓"/> | ||
|
|
||
| <TextView | ||
| android:layout_width="wrap_content" | ||
| android:layout_height="wrap_content" | ||
| android:textColor="@color/white" | ||
| android:text="1 자켓"/> | ||
| </LinearLayout> | ||
| </LinearLayout> | ||
|
|
||
| </androidx.constraintlayout.widget.ConstraintLayout> | ||
|
|
||
| <TextView | ||
| android:layout_width="wrap_content" | ||
| android:layout_height="wrap_content" | ||
| android:text="최근 검색어" | ||
| android:textSize="16sp" | ||
| android:textColor="@color/black" | ||
| android:textStyle="bold" | ||
| android:layout_marginStart="28dp" | ||
| android:layout_marginTop="24dp" | ||
| app:layout_constraintStart_toStartOf="parent" | ||
| app:layout_constraintTop_toBottomOf="@+id/constraint_popular_keyword"/> | ||
|
|
||
| </androidx.constraintlayout.widget.ConstraintLayout> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| <?xml version="1.0" encoding="utf-8"?> | ||
| <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
| android:layout_width="match_parent" | ||
| android:layout_height="match_parent" | ||
| android:layout_marginBottom="32dp" | ||
| android:layout_marginHorizontal="28dp" | ||
| xmlns:app="http://schemas.android.com/apk/res-auto"> | ||
|
|
||
| <TextView | ||
| android:id="@+id/tv_keyword" | ||
| android:layout_width="wrap_content" | ||
| android:layout_height="wrap_content" | ||
| android:text="'키워드'" | ||
| android:textStyle="normal" | ||
| android:textSize="12sp" | ||
| android:textColor="@color/black" | ||
| android:letterSpacing="0.02" | ||
| android:lineSpacingExtra="8sp" | ||
| app:layout_constraintStart_toStartOf="parent" | ||
| app:layout_constraintTop_toTopOf="parent" | ||
| android:layout_marginTop="24dp"/> | ||
|
|
||
| <TextView | ||
| android:layout_width="wrap_content" | ||
| android:layout_height="wrap_content" | ||
| android:text="로 검색한 결과입니다" | ||
| android:textStyle="normal" | ||
| android:textSize="12sp" | ||
| android:textColor="@color/black" | ||
| android:letterSpacing="0.02" | ||
| android:lineSpacingExtra="8sp" | ||
| android:layout_marginTop="24dp" | ||
| app:layout_constraintStart_toEndOf="@id/tv_keyword" | ||
| app:layout_constraintTop_toTopOf="parent"/> | ||
|
|
||
| </androidx.constraintlayout.widget.ConstraintLayout> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
꼭... 꼭... 플로우 돌입하기 전에 ... scope의 종류에 대해 한 번 더 꼭 알아보는 시간.. .꼭 ....