Showing
10 changed files
with
306 additions
and
22 deletions
... | @@ -34,7 +34,7 @@ dependencies { | ... | @@ -34,7 +34,7 @@ dependencies { |
34 | implementation 'com.google.android.gms:play-services-auth:17.0.0' | 34 | implementation 'com.google.android.gms:play-services-auth:17.0.0' |
35 | implementation 'androidx.recyclerview:recyclerview:1.1.0-beta05' | 35 | implementation 'androidx.recyclerview:recyclerview:1.1.0-beta05' |
36 | implementation 'com.android.support:appcompat-v7:27.1.1' | 36 | implementation 'com.android.support:appcompat-v7:27.1.1' |
37 | - implementation 'com.android.support:design:27.1.1' | 37 | + implementation 'com.android.support:design:28.0.0' |
38 | 38 | ||
39 | implementation 'com.google.firebase:firebase-analytics:17.2.0' | 39 | implementation 'com.google.firebase:firebase-analytics:17.2.0' |
40 | implementation 'com.google.firebase:firebase-messaging:20.0.0' | 40 | implementation 'com.google.firebase:firebase-messaging:20.0.0' | ... | ... |
... | @@ -23,7 +23,7 @@ | ... | @@ -23,7 +23,7 @@ |
23 | <activity android:name=".SignInActivity" /> | 23 | <activity android:name=".SignInActivity" /> |
24 | <activity android:name=".SignUpActivity" /> | 24 | <activity android:name=".SignUpActivity" /> |
25 | <activity android:name=".MainActivity" /> | 25 | <activity android:name=".MainActivity" /> |
26 | - <activity android:name=".SearchActivity" /> | 26 | + <activity android:name=".SearchActivity" android:windowSoftInputMode="adjustNothing"/> |
27 | <activity | 27 | <activity |
28 | android:name=".SplashActivity" | 28 | android:name=".SplashActivity" |
29 | android:theme="@style/SplashTheme"> | 29 | android:theme="@style/SplashTheme"> | ... | ... |
... | @@ -28,7 +28,6 @@ class MainActivity : AppCompatActivity() { | ... | @@ -28,7 +28,6 @@ class MainActivity : AppCompatActivity() { |
28 | super.onCreate(savedInstanceState) | 28 | super.onCreate(savedInstanceState) |
29 | //onboarding start | 29 | //onboarding start |
30 | 30 | ||
31 | - | ||
32 | //onboarding end | 31 | //onboarding end |
33 | setContentView(R.layout.activity_main) | 32 | setContentView(R.layout.activity_main) |
34 | 33 | ... | ... |
1 | package com.example.vip | 1 | package com.example.vip |
2 | 2 | ||
3 | +import android.content.Context | ||
3 | import android.os.Bundle | 4 | import android.os.Bundle |
4 | import androidx.appcompat.app.AppCompatActivity | 5 | import androidx.appcompat.app.AppCompatActivity |
5 | //import androidx.appcompat.widget.SearchView | 6 | //import androidx.appcompat.widget.SearchView |
6 | -import android.widget.SearchView | ||
7 | -import android.widget.Toast | ||
8 | import androidx.core.app.ComponentActivity.ExtraData | 7 | import androidx.core.app.ComponentActivity.ExtraData |
9 | import androidx.core.content.ContextCompat.getSystemService | 8 | import androidx.core.content.ContextCompat.getSystemService |
10 | import android.icu.lang.UCharacter.GraphemeClusterBreak.T | 9 | import android.icu.lang.UCharacter.GraphemeClusterBreak.T |
11 | import android.view.View | 10 | import android.view.View |
12 | -import android.widget.Button | ||
13 | import android.content.Intent | 11 | import android.content.Intent |
14 | import android.util.Log | 12 | import android.util.Log |
13 | +import android.view.inputmethod.InputMethodManager | ||
14 | +import android.widget.* | ||
15 | import androidx.core.content.ContextCompat | 15 | import androidx.core.content.ContextCompat |
16 | import com.google.firebase.database.* | 16 | import com.google.firebase.database.* |
17 | import com.google.firebase.database.DatabaseReference | 17 | import com.google.firebase.database.DatabaseReference |
... | @@ -35,21 +35,43 @@ class SearchActivity : AppCompatActivity() { | ... | @@ -35,21 +35,43 @@ class SearchActivity : AppCompatActivity() { |
35 | setContentView(R.layout.search) | 35 | setContentView(R.layout.search) |
36 | 36 | ||
37 | val searchList = ArrayList<SearchItem>() | 37 | val searchList = ArrayList<SearchItem>() |
38 | - | 38 | + val no_search : ImageView = findViewById(R.id.no_matching) // 노서치이미지 |
39 | - | ||
40 | 39 | ||
41 | val searchView: SearchView | 40 | val searchView: SearchView |
42 | searchView = findViewById(R.id.searchForm) | 41 | searchView = findViewById(R.id.searchForm) |
42 | + //searchView.onActionViewExpanded(); //new Added line | ||
43 | + searchView.setIconifiedByDefault(false) | ||
44 | + | ||
45 | + fun CloseKeyboard() | ||
46 | + { | ||
47 | + var view = this.currentFocus | ||
48 | + | ||
49 | + if(view != null) | ||
50 | + { | ||
51 | + val inputMethodManager = getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager | ||
52 | + inputMethodManager.hideSoftInputFromWindow(view.windowToken, 0) | ||
53 | + } | ||
54 | + } | ||
43 | 55 | ||
44 | searchView.setOnQueryTextListener(object : SearchView.OnQueryTextListener { | 56 | searchView.setOnQueryTextListener(object : SearchView.OnQueryTextListener { |
45 | override fun onQueryTextSubmit(query: String): Boolean { | 57 | override fun onQueryTextSubmit(query: String): Boolean { |
46 | // 검색 버튼이 눌러졌을 때 이벤트 처리 | 58 | // 검색 버튼이 눌러졌을 때 이벤트 처리 |
59 | + val layout : LinearLayout = findViewById(R.id.hashtag_linear) | ||
60 | + layout.setVisibility(View.GONE) | ||
47 | 61 | ||
62 | + CloseKeyboard() | ||
48 | database.orderByChild("Policy").startAt("$query").endAt("$query"+"\uf8ff").addListenerForSingleValueEvent(object : ValueEventListener { | 63 | database.orderByChild("Policy").startAt("$query").endAt("$query"+"\uf8ff").addListenerForSingleValueEvent(object : ValueEventListener { |
49 | override fun onCancelled(p0: DatabaseError) { | 64 | override fun onCancelled(p0: DatabaseError) { |
50 | Toast.makeText(this@SearchActivity, "실패부분 : $query", Toast.LENGTH_SHORT).show() | 65 | Toast.makeText(this@SearchActivity, "실패부분 : $query", Toast.LENGTH_SHORT).show() |
51 | } | 66 | } |
52 | override fun onDataChange(dataSnapshot: DataSnapshot) { | 67 | override fun onDataChange(dataSnapshot: DataSnapshot) { |
68 | + if (dataSnapshot.exists() == false){ // 값 없을 때 | ||
69 | + no_search.setVisibility(View.VISIBLE) | ||
70 | + } | ||
71 | + else { | ||
72 | + no_search.setVisibility(View.GONE) | ||
73 | + } | ||
74 | + | ||
53 | for (memoSnapshot in dataSnapshot.children){ | 75 | for (memoSnapshot in dataSnapshot.children){ |
54 | val memo = memoSnapshot.getValue(MemoItem::class.java) | 76 | val memo = memoSnapshot.getValue(MemoItem::class.java) |
55 | 77 | ... | ... |
... | @@ -4,6 +4,7 @@ import android.content.Intent | ... | @@ -4,6 +4,7 @@ import android.content.Intent |
4 | import android.os.Bundle | 4 | import android.os.Bundle |
5 | import android.view.Menu | 5 | import android.view.Menu |
6 | import android.view.MenuItem | 6 | import android.view.MenuItem |
7 | +import android.widget.Toast | ||
7 | import androidx.appcompat.app.ActionBar | 8 | import androidx.appcompat.app.ActionBar |
8 | import androidx.appcompat.app.AppCompatActivity | 9 | import androidx.appcompat.app.AppCompatActivity |
9 | import androidx.core.content.ContextCompat | 10 | import androidx.core.content.ContextCompat |
... | @@ -90,6 +91,20 @@ class SignInActivity : AppCompatActivity() { | ... | @@ -90,6 +91,20 @@ class SignInActivity : AppCompatActivity() { |
90 | return true | 91 | return true |
91 | } | 92 | } |
92 | 93 | ||
94 | + var back_pressed: Long = 0 // 뒤로가기 종료 | ||
95 | + | ||
96 | + override fun onBackPressed() { | ||
97 | + if (back_pressed + 2000 > System.currentTimeMillis()) { | ||
98 | + finishAffinity() | ||
99 | + System.runFinalization() | ||
100 | + System.exit(0) | ||
101 | + } | ||
102 | + //super.onBackPressed() | ||
103 | + else | ||
104 | + Toast.makeText(getBaseContext(), "\'뒤로\' 버튼을 한번 더 누르시면 종료됩니다.", Toast.LENGTH_SHORT).show() | ||
105 | + back_pressed = System.currentTimeMillis() | ||
106 | + } | ||
107 | + | ||
93 | // 4.툴바 메뉴 버튼이 클릭 됐을 때 콜백 | 108 | // 4.툴바 메뉴 버튼이 클릭 됐을 때 콜백 |
94 | override fun onOptionsItemSelected(item: MenuItem?): Boolean { | 109 | override fun onOptionsItemSelected(item: MenuItem?): Boolean { |
95 | // 클릭된 메뉴 아이템의 아이디 마다 when 구절로 클릭시 동작을 설정한다. | 110 | // 클릭된 메뉴 아이템의 아이디 마다 when 구절로 클릭시 동작을 설정한다. | ... | ... |

13.5 KB

13.5 KB

13.5 KB
1 | +<?xml version="1.0" encoding="utf-8"?> | ||
2 | +<shape xmlns:android="http://schemas.android.com/apk/res/android" | ||
3 | + android:shape="rectangle" > | ||
4 | + <solid android:color="@android:color/transparent" /> | ||
5 | + <stroke | ||
6 | + android:width="3dp" | ||
7 | + android:color="#C029ABE2" /> | ||
8 | + <corners android:radius="30dp"/> | ||
9 | + <!--<padding | ||
10 | + android:top="8dp"/>--> | ||
11 | + | ||
12 | +</shape> | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
... | @@ -2,24 +2,260 @@ | ... | @@ -2,24 +2,260 @@ |
2 | <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | 2 | <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" |
3 | xmlns:app="http://schemas.android.com/apk/res-auto" | 3 | xmlns:app="http://schemas.android.com/apk/res-auto" |
4 | xmlns:tools="http://schemas.android.com/tools" | 4 | xmlns:tools="http://schemas.android.com/tools" |
5 | - android:orientation="vertical" | ||
6 | android:layout_width="match_parent" | 5 | android:layout_width="match_parent" |
7 | - android:layout_height="wrap_content"> | 6 | + android:layout_height="match_parent" |
7 | + android:orientation="vertical" | ||
8 | + android:weightSum="2"> | ||
8 | 9 | ||
9 | - <SearchView | 10 | + <androidx.appcompat.widget.Toolbar |
10 | - android:id="@+id/searchForm" | 11 | + android:id="@+id/toolbar" |
11 | - android:queryHint="복지 정책 입력" | 12 | + android:layout_width="fill_parent" |
12 | - app:showAsAction="always" | 13 | + android:layout_height="wrap_content" |
13 | - android:layout_width="match_parent" | 14 | + android:layout_marginBottom="11dp" |
14 | - android:layout_height="wrap_content" > | 15 | + android:background="#FFF" |
16 | + android:elevation="5dp" | ||
17 | + android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar" | ||
18 | + app:popupTheme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"> | ||
15 | 19 | ||
16 | - </SearchView> | 20 | + <TextView |
21 | + android:layout_width="wrap_content" | ||
22 | + android:layout_height="wrap_content" | ||
23 | + android:text="모든 정책 검색" | ||
24 | + android:textSize="20dp" | ||
25 | + android:textColor="#000" | ||
26 | + android:layout_gravity="center" | ||
27 | + android:layout_centerHorizontal="true" /> | ||
28 | + </androidx.appcompat.widget.Toolbar> | ||
17 | 29 | ||
18 | - <androidx.recyclerview.widget.RecyclerView | 30 | + <LinearLayout |
19 | - android:id="@+id/searchRecyclerView" | ||
20 | android:layout_width="match_parent" | 31 | android:layout_width="match_parent" |
21 | - android:layout_height="wrap_content" | 32 | + android:layout_height="match_parent" |
22 | - app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" | 33 | + android:orientation="vertical"> |
23 | - tools:listitem="@layout/item_search" /> | 34 | + |
35 | + <LinearLayout | ||
36 | + android:layout_width="match_parent" | ||
37 | + android:layout_height="200dp" | ||
38 | + android:layout_weight="1" | ||
39 | + android:orientation="vertical"> | ||
40 | + | ||
41 | + <SearchView | ||
42 | + android:id="@+id/searchForm" | ||
43 | + android:layout_width="match_parent" | ||
44 | + android:layout_height="wrap_content" | ||
45 | + android:layout_marginLeft="9dp" | ||
46 | + android:layout_marginTop="30dp" | ||
47 | + android:layout_marginRight="9dp" | ||
48 | + android:layout_marginBottom="9dp" | ||
49 | + android:background="@drawable/searchview_edge" | ||
50 | + android:focusable="false" | ||
51 | + android:layoutDirection="rtl" | ||
52 | + android:paddingStart="7dp" | ||
53 | + android:queryHint=" 정책명, 대상, 키워드를 입력하세요" | ||
54 | + app:iconifiedByDefault="false" | ||
55 | + app:showAsAction="always" /> | ||
56 | + | ||
57 | + <androidx.recyclerview.widget.RecyclerView | ||
58 | + android:id="@+id/searchRecyclerView" | ||
59 | + android:layout_width="match_parent" | ||
60 | + android:layout_height="match_parent" | ||
61 | + app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" | ||
62 | + tools:listitem="@layout/item_search"> | ||
63 | + | ||
64 | + </androidx.recyclerview.widget.RecyclerView> | ||
65 | + </LinearLayout> | ||
66 | + | ||
67 | + <ImageView | ||
68 | + android:id="@+id/no_matching" | ||
69 | + android:layout_width="match_parent" | ||
70 | + android:layout_height="wrap_content" | ||
71 | + android:layout_gravity="center" | ||
72 | + android:contentDescription="img" | ||
73 | + android:visibility="gone" | ||
74 | + app:srcCompat="@drawable/not_matching" | ||
75 | + tools:srcCompat="@drawable/not_matching" /> | ||
76 | + | ||
77 | + <LinearLayout | ||
78 | + android:id="@+id/hashtag_linear" | ||
79 | + android:layout_width="match_parent" | ||
80 | + android:layout_height="200dp" | ||
81 | + android:layout_weight="1.1" | ||
82 | + android:orientation="vertical"> | ||
83 | + | ||
84 | + <FrameLayout | ||
85 | + android:layout_width="wrap_content" | ||
86 | + android:layout_height="wrap_content"> | ||
87 | + | ||
88 | + <View | ||
89 | + android:id="@+id/view2" | ||
90 | + android:layout_width="match_parent" | ||
91 | + android:layout_height="match_parent" | ||
92 | + android:background="#6629ABE2" /> | ||
93 | + | ||
94 | + <FrameLayout | ||
95 | + android:layout_width="match_parent" | ||
96 | + android:layout_height="match_parent"> | ||
97 | + | ||
98 | + <com.google.android.material.chip.ChipGroup | ||
99 | + android:layout_width="match_parent" | ||
100 | + android:layout_height="wrap_content" | ||
101 | + android:layout_gravity="center|center_horizontal|center_vertical" | ||
102 | + android:layout_marginStart="17dp" | ||
103 | + android:foregroundGravity="center_vertical|center|center_horizontal"> | ||
104 | + | ||
105 | + | ||
106 | + <com.google.android.material.chip.ChipGroup | ||
107 | + android:layout_width="match_parent" | ||
108 | + android:layout_height="wrap_content"> | ||
109 | + | ||
110 | + <TextView | ||
111 | + android:id="@+id/textView" | ||
112 | + android:layout_width="wrap_content" | ||
113 | + android:layout_height="wrap_content" | ||
114 | + android:text="가구상황별" /> | ||
115 | + | ||
116 | + | ||
117 | + <com.google.android.material.chip.ChipGroup | ||
118 | + android:layout_width="match_parent" | ||
119 | + android:layout_height="wrap_content"> | ||
120 | + | ||
121 | + <com.google.android.material.chip.Chip | ||
122 | + style="@style/Widget.MaterialComponents.Chip.Choice" | ||
123 | + android:layout_width="wrap_content" | ||
124 | + app:chipBackgroundColor="#C6FFFFFF" | ||
125 | + android:layout_height="wrap_content" | ||
126 | + android:layout_marginBottom="5dp" | ||
127 | + android:checkable="false" | ||
128 | + android:text="# 장애인" | ||
129 | + android:textAppearance="@style/TextAppearance.AppCompat" /> | ||
130 | + | ||
131 | + <com.google.android.material.chip.Chip | ||
132 | + style="@style/Widget.MaterialComponents.Chip.Choice" | ||
133 | + android:layout_width="wrap_content" | ||
134 | + android:layout_height="wrap_content" | ||
135 | + android:layout_marginBottom="5dp" | ||
136 | + android:checkable="false" | ||
137 | + app:chipBackgroundColor="#C6FFFFFF" | ||
138 | + android:text="# 한부모" | ||
139 | + android:textAppearance="@style/TextAppearance.AppCompat" /> | ||
140 | + | ||
141 | + | ||
142 | + <com.google.android.material.chip.Chip | ||
143 | + style="@style/Widget.MaterialComponents.Chip.Choice" | ||
144 | + android:layout_width="wrap_content" | ||
145 | + android:layout_height="wrap_content" | ||
146 | + android:layout_marginBottom="5dp" | ||
147 | + android:checkable="false" | ||
148 | + app:chipBackgroundColor="#C6FFFFFF" | ||
149 | + android:text="# 다문화" | ||
150 | + android:textAppearance="@style/TextAppearance.AppCompat" /> | ||
151 | + </com.google.android.material.chip.ChipGroup> | ||
152 | + | ||
153 | + <com.google.android.material.chip.ChipGroup | ||
154 | + android:layout_width="match_parent" | ||
155 | + android:layout_height="wrap_content"> | ||
156 | + | ||
157 | + <com.google.android.material.chip.Chip | ||
158 | + style="@style/Widget.MaterialComponents.Chip.Choice" | ||
159 | + android:layout_width="wrap_content" | ||
160 | + android:layout_height="wrap_content" | ||
161 | + android:checkable="false" | ||
162 | + app:chipBackgroundColor="#C6FFFFFF" | ||
163 | + android:text="# 저소득층" | ||
164 | + android:textAppearance="@style/TextAppearance.AppCompat" | ||
165 | + app:chipIcon="@drawable/image01" /> | ||
166 | + | ||
167 | + <com.google.android.material.chip.Chip | ||
168 | + style="@style/Widget.MaterialComponents.Chip.Choice" | ||
169 | + android:layout_width="wrap_content" | ||
170 | + android:layout_height="wrap_content" | ||
171 | + android:checkable="false" | ||
172 | + app:chipBackgroundColor="#C6FFFFFF" | ||
173 | + android:text="# 임신/출산" | ||
174 | + android:textAppearance="@style/TextAppearance.AppCompat" /> | ||
175 | + | ||
176 | + </com.google.android.material.chip.ChipGroup> | ||
177 | + </com.google.android.material.chip.ChipGroup> | ||
178 | + | ||
179 | + <com.google.android.material.chip.ChipGroup | ||
180 | + android:layout_width="match_parent" | ||
181 | + android:layout_height="wrap_content" | ||
182 | + android:layout_gravity="center|center_horizontal|center_vertical" | ||
183 | + android:foregroundGravity="center_vertical|center|center_horizontal"> | ||
184 | + | ||
185 | + <TextView | ||
186 | + android:id="@+id/textVㅇiew" | ||
187 | + android:layout_width="wrap_content" | ||
188 | + android:layout_height="wrap_content" | ||
189 | + android:text="\n생애주기별" /> | ||
190 | + | ||
191 | + | ||
192 | + <com.google.android.material.chip.ChipGroup | ||
193 | + android:layout_width="match_parent" | ||
194 | + android:layout_height="wrap_content"> | ||
195 | + | ||
196 | + <com.google.android.material.chip.Chip | ||
197 | + style="@style/Widget.MaterialComponents.Chip.Choice" | ||
198 | + android:layout_width="wrap_content" | ||
199 | + android:layout_height="wrap_content" | ||
200 | + android:layout_marginBottom="5dp" | ||
201 | + android:checkable="false" | ||
202 | + app:chipBackgroundColor="#C6FFFFFF" | ||
203 | + android:text="# 아동" | ||
204 | + android:textAppearance="@style/TextAppearance.AppCompat" /> | ||
205 | + | ||
206 | + <com.google.android.material.chip.Chip | ||
207 | + style="@style/Widget.MaterialComponents.Chip.Choice" | ||
208 | + android:layout_width="wrap_content" | ||
209 | + android:layout_height="wrap_content" | ||
210 | + android:layout_marginBottom="5dp" | ||
211 | + android:checkable="false" | ||
212 | + app:chipBackgroundColor="#C6FFFFFF" | ||
213 | + android:text="# 청소년" | ||
214 | + android:textAppearance="@style/TextAppearance.AppCompat" /> | ||
215 | + | ||
216 | + | ||
217 | + <com.google.android.material.chip.Chip | ||
218 | + style="@style/Widget.MaterialComponents.Chip.Choice" | ||
219 | + android:layout_width="wrap_content" | ||
220 | + android:layout_height="wrap_content" | ||
221 | + android:layout_marginBottom="5dp" | ||
222 | + android:checkable="false" | ||
223 | + app:chipBackgroundColor="#C6FFFFFF" | ||
224 | + android:text="# 청년" | ||
225 | + android:textAppearance="@style/TextAppearance.AppCompat" /> | ||
226 | + </com.google.android.material.chip.ChipGroup> | ||
227 | + | ||
228 | + <com.google.android.material.chip.ChipGroup | ||
229 | + android:layout_width="match_parent" | ||
230 | + android:layout_height="wrap_content"> | ||
231 | + | ||
232 | + <com.google.android.material.chip.Chip | ||
233 | + style="@style/Widget.MaterialComponents.Chip.Choice" | ||
234 | + android:layout_width="wrap_content" | ||
235 | + android:layout_height="wrap_content" | ||
236 | + android:checkable="false" | ||
237 | + app:chipBackgroundColor="#C6FFFFFF" | ||
238 | + android:text="# 중장년" | ||
239 | + android:textAppearance="@style/TextAppearance.AppCompat" | ||
240 | + app:chipIcon="@drawable/image01" /> | ||
241 | + | ||
242 | + <com.google.android.material.chip.Chip | ||
243 | + style="@style/Widget.MaterialComponents.Chip.Choice" | ||
244 | + android:layout_width="wrap_content" | ||
245 | + android:layout_height="wrap_content" | ||
246 | + android:checkable="false" | ||
247 | + app:chipBackgroundColor="#C6FFFFFF" | ||
248 | + android:text="# 노년" | ||
249 | + android:textAppearance="@style/TextAppearance.AppCompat" /> | ||
250 | + | ||
251 | + </com.google.android.material.chip.ChipGroup> | ||
252 | + </com.google.android.material.chip.ChipGroup> | ||
253 | + </com.google.android.material.chip.ChipGroup> | ||
254 | + | ||
255 | + </FrameLayout> | ||
256 | + | ||
257 | + </FrameLayout> | ||
24 | 258 | ||
259 | + </LinearLayout> | ||
260 | + </LinearLayout> | ||
25 | </LinearLayout> | 261 | </LinearLayout> |
... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
-
Please register or login to post a comment