Showing
10 changed files
with
56 additions
and
8 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 |
This diff is collapsed. Click to expand it.
-
Please register or login to post a comment