soonmyeong2

search menu redesinged

wello_firebase_SDKKey.json
\ No newline at end of file
import firebase_admin
from firebase_admin import credentials
from firebase_admin import messaging
cred = credentials.Certificate("./wello_firebase_SDKKey.json")
wello = firebase_admin.initialize_app(cred)
print("WELLO project name : ", wello.project_id)
# These registration tokens come from the client FCM SDKs.
registration_tokens = [
"eSNbW5he2RA:APA91bHqe2ir6xeYq-R143J3pmAD1KuYuPqa-_3oHIw93hQKe9nMGZ2Ol3foV9GXciZCP8WHUbfIEb7Ymr-BGSl22Tau_mvOSqVTqNP5V2UU8sbOjZm9TgBxirxy-A0KynHxKCLcMnYF"
"dJCm74G7qY0:APA91bGydGRjb91_bX6X8Oyx0kqyFHoXzgF0ZZmD_IygEDCqYPHxJ46os8sHytEmHWIpASDzTk-RZESgkZvdcJavKLJWtVY5uxWl2xUEPefyrcJ-kLWnLHcgPbDTCVLoGe_ZivOFuY9Y"
]
# Subscribe the devices corresponding to the registration tokens to the
# topic.
response = messaging.subscribe_to_topic(registration_tokens, "kisung")
# See the TopicManagementResponse reference documentation
# for the contents of response.
print(response.success_count, 'tokens were subscribed successfully')
......@@ -19,10 +19,9 @@
android:theme="@style/SplashTheme">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
</manifest>
\ No newline at end of file
......
......@@ -47,7 +47,6 @@ class MainActivity : AppCompatActivity() {
emailSigninBtn.setOnClickListener{
loginEmail()
}
emailSignupBtn.setOnClickListener {
......
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 androidx.core.content.ContextCompat
import com.google.firebase.database.*
import com.google.firebase.database.DatabaseReference
import com.google.firebase.database.FirebaseDatabase
import kotlinx.android.synthetic.main.search.*
import androidx.core.app.ComponentActivity.ExtraData
import androidx.core.content.ContextCompat.getSystemService
import android.icu.lang.UCharacter.GraphemeClusterBreak.T
......@@ -30,6 +33,13 @@ data class MemoItem(
var database = FirebaseDatabase.getInstance().reference
class SearchActivity : AppCompatActivity() {
fun View.hideKeyboard() {
val imm = context.getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager
imm.hideSoftInputFromWindow(windowToken, 0)
}
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.search)
......@@ -45,6 +55,10 @@ class SearchActivity : AppCompatActivity() {
override fun onQueryTextSubmit(query: String): Boolean {
// 검색 버튼이 눌러졌을 때 이벤트 처리
//버튼 눌를때 아래 삭제
view.hideKeyboard()
view.visibility = View.GONE
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()
......
......@@ -41,8 +41,6 @@ class SignUpActivity : AppCompatActivity() {
}
}
//pushing code end
}
//pushing code start 2
......
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
android:layout_height="match_parent"
android:orientation="vertical">
<SearchView
android:id="@+id/searchForm"
android:queryHint="복지 정책 입력"
app:showAsAction="always"
android:layout_width="match_parent"
android:layout_height="wrap_content" >
</SearchView>
android:layout_height="wrap_content"
android:queryHint="복지 정책 입력"
app:showAsAction="always"/>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/searchRecyclerView"
android:layout_width="match_parent"
android:layout_height="340dp"
android:layout_height="668dp"
android:layout_above="@+id/view"
android:layout_below="@+id/searchForm"
android:layout_alignParentStart="true"
android:layout_marginStart="0dp"
android:layout_marginTop="15dp"
android:layout_marginBottom="-320dp"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
app:spanCount="3"
app:layout_constraintBottom_toBottomOf="@id/bottom_navigation"
tools:listitem="@layout/item_search" />
</LinearLayout>
\ No newline at end of file
<View
android:id="@+id/view"
android:layout_width="match_parent"
android:layout_height="320dp"
android:layout_alignParentStart="true"
android:layout_alignParentBottom="true"
android:layout_marginStart="0dp"
android:background="#8029ABE2"
app:layout_constraintStart_toStartOf="@id/searchRecyclerView"
app:layout_constraintTop_toTopOf="@id/searchRecyclerView" />
</RelativeLayout>
\ No newline at end of file
......