Toggle navigation
Toggle navigation
This project
Loading...
Sign in
장연우
/
WELLO
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Graphs
Network
Create a new issue
Commits
Issue Boards
Authored by
soonmyeong2
2019-11-10 21:23:06 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
cf73d1d2b62b74df8bb7a4c70c6bc3a064165707
cf73d1d2
1 parent
92ae639e
검색창 디자인 및 앱 종료 최적화
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
56 additions
and
8 deletions
vip/app/build.gradle
vip/app/src/main/AndroidManifest.xml
vip/app/src/main/java/com/example/vip/MainActivity.kt
vip/app/src/main/java/com/example/vip/SearchActivity.kt
vip/app/src/main/java/com/example/vip/SignInActivity.kt
vip/app/src/main/res/drawable-nodpi/not_matching.jpg
vip/app/src/main/res/drawable-v24/not_matching.jpg
vip/app/src/main/res/drawable/not_matching.jpg
vip/app/src/main/res/drawable/searchview_edge.xml
vip/app/src/main/res/layout/search.xml
vip/app/build.gradle
View file @
cf73d1d
...
...
@@ -34,7 +34,7 @@ dependencies {
implementation
'com.google.android.gms:play-services-auth:17.0.0'
implementation
'androidx.recyclerview:recyclerview:1.1.0-beta05'
implementation
'com.android.support:appcompat-v7:27.1.1'
implementation
'com.android.support:design:2
7.1.1
'
implementation
'com.android.support:design:2
8.0.0
'
implementation
'com.google.firebase:firebase-analytics:17.2.0'
implementation
'com.google.firebase:firebase-messaging:20.0.0'
...
...
vip/app/src/main/AndroidManifest.xml
View file @
cf73d1d
...
...
@@ -23,7 +23,7 @@
<activity
android:name=
".SignInActivity"
/>
<activity
android:name=
".SignUpActivity"
/>
<activity
android:name=
".MainActivity"
/>
<activity
android:name=
".SearchActivity"
/>
<activity
android:name=
".SearchActivity"
android:windowSoftInputMode=
"adjustNothing"
/>
<activity
android:name=
".SplashActivity"
android:theme=
"@style/SplashTheme"
>
...
...
vip/app/src/main/java/com/example/vip/MainActivity.kt
View file @
cf73d1d
...
...
@@ -28,7 +28,6 @@ class MainActivity : AppCompatActivity() {
super
.
onCreate
(
savedInstanceState
)
//onboarding start
//onboarding end
setContentView
(
R
.
layout
.
activity_main
)
...
...
vip/app/src/main/java/com/example/vip/SearchActivity.kt
View file @
cf73d1d
package
com.example.vip
import
android.content.Context
import
android.os.Bundle
import
androidx.appcompat.app.AppCompatActivity
//import androidx.appcompat.widget.SearchView
import
android.widget.SearchView
import
android.widget.Toast
import
androidx.core.app.ComponentActivity.ExtraData
import
androidx.core.content.ContextCompat.getSystemService
import
android.icu.lang.UCharacter.GraphemeClusterBreak.T
import
android.view.View
import
android.widget.Button
import
android.content.Intent
import
android.util.Log
import
android.view.inputmethod.InputMethodManager
import
android.widget.*
import
androidx.core.content.ContextCompat
import
com.google.firebase.database.*
import
com.google.firebase.database.DatabaseReference
...
...
@@ -35,21 +35,43 @@ class SearchActivity : AppCompatActivity() {
setContentView
(
R
.
layout
.
search
)
val
searchList
=
ArrayList
<
SearchItem
>()
val
no_search
:
ImageView
=
findViewById
(
R
.
id
.
no_matching
)
// 노서치이미지
val
searchView
:
SearchView
searchView
=
findViewById
(
R
.
id
.
searchForm
)
//searchView.onActionViewExpanded(); //new Added line
searchView
.
setIconifiedByDefault
(
false
)
fun
CloseKeyboard
()
{
var
view
=
this
.
currentFocus
if
(
view
!=
null
)
{
val
inputMethodManager
=
getSystemService
(
Context
.
INPUT_METHOD_SERVICE
)
as
InputMethodManager
inputMethodManager
.
hideSoftInputFromWindow
(
view
.
windowToken
,
0
)
}
}
searchView
.
setOnQueryTextListener
(
object
:
SearchView
.
OnQueryTextListener
{
override
fun
onQueryTextSubmit
(
query
:
String
):
Boolean
{
// 검색 버튼이 눌러졌을 때 이벤트 처리
val
layout
:
LinearLayout
=
findViewById
(
R
.
id
.
hashtag_linear
)
layout
.
setVisibility
(
View
.
GONE
)
CloseKeyboard
()
database
.
orderByChild
(
"Policy"
).
startAt
(
"$query"
).
endAt
(
"$query"
+
"\uf8ff"
).
addListenerForSingleValueEvent
(
object
:
ValueEventListener
{
override
fun
onCancelled
(
p0
:
DatabaseError
)
{
Toast
.
makeText
(
this
@SearchActivity
,
"실패부분 : $query"
,
Toast
.
LENGTH_SHORT
).
show
()
}
override
fun
onDataChange
(
dataSnapshot
:
DataSnapshot
)
{
if
(
dataSnapshot
.
exists
()
==
false
){
// 값 없을 때
no_search
.
setVisibility
(
View
.
VISIBLE
)
}
else
{
no_search
.
setVisibility
(
View
.
GONE
)
}
for
(
memoSnapshot
in
dataSnapshot
.
children
){
val
memo
=
memoSnapshot
.
getValue
(
MemoItem
::
class
.
java
)
...
...
vip/app/src/main/java/com/example/vip/SignInActivity.kt
View file @
cf73d1d
...
...
@@ -4,6 +4,7 @@ import android.content.Intent
import
android.os.Bundle
import
android.view.Menu
import
android.view.MenuItem
import
android.widget.Toast
import
androidx.appcompat.app.ActionBar
import
androidx.appcompat.app.AppCompatActivity
import
androidx.core.content.ContextCompat
...
...
@@ -90,6 +91,20 @@ class SignInActivity : AppCompatActivity() {
return
true
}
var
back_pressed
:
Long
=
0
// 뒤로가기 종료
override
fun
onBackPressed
()
{
if
(
back_pressed
+
2000
>
System
.
currentTimeMillis
())
{
finishAffinity
()
System
.
runFinalization
()
System
.
exit
(
0
)
}
//super.onBackPressed()
else
Toast
.
makeText
(
getBaseContext
(),
"\'뒤로\' 버튼을 한번 더 누르시면 종료됩니다."
,
Toast
.
LENGTH_SHORT
).
show
()
back_pressed
=
System
.
currentTimeMillis
()
}
// 4.툴바 메뉴 버튼이 클릭 됐을 때 콜백
override
fun
onOptionsItemSelected
(
item
:
MenuItem
?):
Boolean
{
// 클릭된 메뉴 아이템의 아이디 마다 when 구절로 클릭시 동작을 설정한다.
...
...
vip/app/src/main/res/drawable-nodpi/not_matching.jpg
0 → 100644
View file @
cf73d1d
13.5 KB
vip/app/src/main/res/drawable-v24/not_matching.jpg
0 → 100644
View file @
cf73d1d
13.5 KB
vip/app/src/main/res/drawable/not_matching.jpg
0 → 100644
View file @
cf73d1d
13.5 KB
vip/app/src/main/res/drawable/searchview_edge.xml
0 → 100644
View file @
cf73d1d
<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:shape=
"rectangle"
>
<solid
android:color=
"@android:color/transparent"
/>
<stroke
android:width=
"3dp"
android:color=
"#C029ABE2"
/>
<corners
android:radius=
"30dp"
/>
<!--<padding
android:top="8dp"/>-->
</shape>
\ No newline at end of file
vip/app/src/main/res/layout/search.xml
View file @
cf73d1d
This diff is collapsed. Click to expand it.
Please
register
or
login
to post a comment