Showing
16 changed files
with
32 additions
and
406 deletions
D_dayCalculator.py
deleted
100644 → 0
1 | -#-*- coding: utf-8 -*- | ||
2 | -from datetime import datetime, timedelta | ||
3 | -import re | ||
4 | - | ||
5 | -class D_day: | ||
6 | - def __init__(self, date_str): | ||
7 | - self.date = date_str | ||
8 | - | ||
9 | - def dday_calculate(self, date): | ||
10 | - y_m_d = date.split("-") | ||
11 | - return (datetime.now() - datetime(int(y_m_d[0]), int(y_m_d[1]), int(y_m_d[2]))).days | ||
12 | - | ||
13 | - | ||
14 | - def date_calculate(self): | ||
15 | - dates = re.findall(r'[0-9]{2,4}[.|-][0-9]{1,2}[.|-][0-9]{1,2}|~', self.date) | ||
16 | - | ||
17 | - for i in range(len(dates)): | ||
18 | - dates[i] = dates[i].replace(".", "-") | ||
19 | - | ||
20 | - # 날짜가 없는 경우 | ||
21 | - if len(dates) == 0: | ||
22 | - return "상시" | ||
23 | - | ||
24 | - # XXX ~ | ||
25 | - if dates[-1] == "~": | ||
26 | - dday = self.dday_calculate(dates[0]) | ||
27 | - if dday > 0: | ||
28 | - return "진행중" | ||
29 | - else: | ||
30 | - return "준비중" | ||
31 | - | ||
32 | - # ~ XXX and XXX ~ XXX | ||
33 | - if dates[-1] != "~": | ||
34 | - dday = self.dday_calculate(dates[-1]) | ||
35 | - if dday < 0: | ||
36 | - return "D"+str(dday) | ||
37 | - else: | ||
38 | - return "종료" | ||
39 | - | ||
40 | - # except | ||
41 | - return "상 시" | ||
42 | - | ||
43 | - | ||
44 | - def update_date(self, date): | ||
45 | - self.date = date | ||
46 | - | ||
47 | -#### example | ||
48 | -''' | ||
49 | -a=D_day("2019.11.20") | ||
50 | -print(a.date_calculate()) | ||
51 | -a.update_date("2019.11.21") | ||
52 | -print(a.date_calculate()) | ||
53 | -a.update_date("~2019.11.30") | ||
54 | -print(a.date_calculate()) | ||
55 | -a.update_date("2019.10.11~2019.11.27") | ||
56 | -print(a.date_calculate()) | ||
57 | -a.update_date("2019.10.11~") | ||
58 | -print(a.date_calculate()) | ||
59 | -''' |
check_policy.py
deleted
100644 → 0
1 | -import hashlib | ||
2 | -from firebase_admin import db | ||
3 | -from firebase_admin import credentials | ||
4 | -import firebase_admin | ||
5 | -import csv | ||
6 | - | ||
7 | - | ||
8 | -cred = credentials.Certificate('wello_firebase_SDKKey.json') | ||
9 | -firebase_admin.initialize_app(cred, {'databaseURL': 'https://capstone-vip.firebaseio.com/'}) | ||
10 | -ref = db.reference() | ||
11 | -policies = ref.get() | ||
12 | - | ||
13 | -## compare dict | ||
14 | -policy_dict = dict() | ||
15 | - | ||
16 | -def policy_hash_writer(policies): | ||
17 | - with open('./hash_policy.csv', 'w', encoding='utf-8', newline='') as csvfile: | ||
18 | - wr = csv.writer(csvfile) | ||
19 | - | ||
20 | - for policy in policies: | ||
21 | - sha = hashlib.sha256() | ||
22 | - sha.update(str(policy).encode('utf-8')) | ||
23 | - wr.writerow([policy["Value"], sha.hexdigest()]) | ||
24 | - | ||
25 | - | ||
26 | -def policy_db_reader(): | ||
27 | - for policy in policies: | ||
28 | - if policy["Value"] in policy_dict.keys(): | ||
29 | - sha = hashlib.sha256() | ||
30 | - sha.update(str(policy).encode('utf-8')) | ||
31 | - if policy_dict[policy["Value"]] != sha.hexdigest(): | ||
32 | - print("change contents : ", policy["Value"], ".", policy["Policy"]) | ||
33 | - else: | ||
34 | - print("new policy : ", policy["Value"], ". ", policy["Policy"]) | ||
35 | - | ||
36 | - | ||
37 | -def policy_hash_reader(): | ||
38 | - with open('./hash_policy.csv', 'r', encoding='utf-8') as csvfile: | ||
39 | - rdr = csv.reader(csvfile) | ||
40 | - | ||
41 | - for r in rdr: | ||
42 | - policy_dict[r[0]] = r[1] | ||
43 | - | ||
44 | -#policy_hash_writer(policies) | ||
45 | -policy_hash_reader() | ||
46 | -policy_db_reader() |
db_updater.py
deleted
100644 → 0
1 | -from firebase_admin import db | ||
2 | -from firebase_admin import credentials | ||
3 | -import firebase_admin | ||
4 | -from D_dayCalculator import D_day | ||
5 | -import json | ||
6 | - | ||
7 | -cred = credentials.Certificate('wello_firebase_SDKKey.json') | ||
8 | -firebase_admin.initialize_app(cred, {'databaseURL': 'https://capstone-vip.firebaseio.com/'}) | ||
9 | -ref = db.reference() | ||
10 | - | ||
11 | -policies = ref.get() | ||
12 | -date = D_day("1970.01.01") | ||
13 | - | ||
14 | -#with open('view_count_raw.json', 'rt', encoding='utf-8') as json_file: | ||
15 | -# view_count = json.load(json_file) | ||
16 | - | ||
17 | - | ||
18 | -for policy in policies: | ||
19 | - # 날짜 갱신 | ||
20 | - date.update_date(policy["Date"]) | ||
21 | - print(date.date_calculate()) | ||
22 | - ref.child(policy["Value"]).child("D_day").set(date.date_calculate()) | ||
23 | - | ||
24 | - | ||
25 | - |
hash_policy.csv
deleted
100644 → 0
1 | -0,d24548533c984425a9a96cbd23e0085baed58a16d26d2764ee3e08f4ec9f2713 | ||
2 | -1,4f2e40e552527f48278fa2cdfadfa34e61c5a1672d82dc2ff42fcb4bff484cc2 | ||
3 | -2,7f41b893ec6ca567b928f9ba975c87e31db98a14fa6bc1c28431ab3a244cca43 | ||
4 | -3,fb6094dc6ba8c21846557664fda37a808f9877f35f301c444194b484e6cf38ae | ||
5 | -4,121b23de7cf0d313077a208739b7a202ddfe6442c3f62dd2ed0cb475411c3bb8 | ||
6 | -5,26e05536f3fc6a844af4a746ecd070157180e4787fb122cf18b5dc8b91d2ff63 | ||
7 | -6,2809644d986b0226b080fdffbe7d3d1453095a12984101edbaefbf61821a8848 | ||
8 | -7,c7e3ac97575b1006424d0f2a391df327dc249067f0361d604355700bbe780102 | ||
9 | -8,3d7f2a439aa277c88101b08d2af865d6610f9791b614d9bbcce5a5f424736bb5 | ||
10 | -9,fba861e8ecc5f5411dec793409f8a98a96cbbb738fba74be397294e288dc7a4b |
push_messaging.py
deleted
100644 → 0
1 | -from firebase_admin import messaging | ||
2 | -from firebase_admin import credentials | ||
3 | -from firebase_admin import datetime | ||
4 | -from firebase_admin import db | ||
5 | -import firebase_admin | ||
6 | -import json | ||
7 | -import re | ||
8 | - | ||
9 | - | ||
10 | -cred = credentials.Certificate('wello_firebase_SDKKey.json') | ||
11 | -firebase_admin.initialize_app(cred, {'databaseURL': 'https://wello-topic.firebaseio.com/'}) | ||
12 | -ref = db.reference() | ||
13 | -topics = list(ref.get()) | ||
14 | -pre_topic = list() | ||
15 | - | ||
16 | - | ||
17 | -def send_to_topic(policy, topic): | ||
18 | - message = messaging.Message( | ||
19 | - android=messaging.AndroidConfig( | ||
20 | - ttl=datetime.timedelta(seconds=3600), | ||
21 | - priority='normal', | ||
22 | - notification=messaging.AndroidNotification( | ||
23 | - title='새 정책 알람', | ||
24 | - body=policy, | ||
25 | - icon='@drawable/mini', | ||
26 | - color='#29ABE2', | ||
27 | - sound='default' | ||
28 | - ), | ||
29 | - ), | ||
30 | - data={ | ||
31 | - 'score': '850', | ||
32 | - 'time': '2:45', | ||
33 | - }, | ||
34 | - webpush=messaging.WebpushConfig( | ||
35 | - notification=messaging.WebpushNotification( | ||
36 | - title='웹 알림', | ||
37 | - body='TEST', | ||
38 | - icon='', | ||
39 | - ), | ||
40 | - ), | ||
41 | - topic=topic, | ||
42 | - ) | ||
43 | - response = messaging.send(message) | ||
44 | - print('Successfully sent message:', response) | ||
45 | - | ||
46 | - | ||
47 | -for topic in topics: | ||
48 | - categorys = re.findall('c[0-9]+[_][0-9]+', topic) | ||
49 | - for i in range(len(categorys) - 1, -1, -1): | ||
50 | - if '1' == categorys[i].split('_')[-1]: | ||
51 | - categorys.pop(i) | ||
52 | - pre_topic.append(categorys) | ||
53 | - | ||
54 | - | ||
55 | -print('new policy category : ', end = '') | ||
56 | -policy = input() | ||
57 | -policy_category = re.findall('c[0-9]+[_][0-9]+', policy) | ||
58 | -policy_category_list = re.findall('c[0-9]+', policy) | ||
59 | -push_index = list() | ||
60 | -flag = True | ||
61 | - | ||
62 | - | ||
63 | -for i, categorys in enumerate(pre_topic): | ||
64 | - for category in categorys: | ||
65 | - if category.split('_')[0] in policy_category_list: | ||
66 | - if category not in policy_category: | ||
67 | - flag = False | ||
68 | - break | ||
69 | - if flag: push_index.append(i) | ||
70 | - flag = True | ||
71 | - | ||
72 | - | ||
73 | -for push in push_index: | ||
74 | - send_to_topic('[가정복지부] 기성이를 보유하신 가정에 지원금을 드립니다.', topics[push]) |
raw_calculate_Dday.py
deleted
100644 → 0
1 | -#-*- coding: utf-8 -*- | ||
2 | -from datetime import datetime, timedelta | ||
3 | -import json | ||
4 | -import re | ||
5 | - | ||
6 | - | ||
7 | -def dday_calculate(date): | ||
8 | - y_m_d = date.split("-") | ||
9 | - return (datetime.now() - datetime(int(y_m_d[0]), int(y_m_d[1]), int(y_m_d[2]))).days | ||
10 | - | ||
11 | - | ||
12 | -def date_calculate(url): | ||
13 | - dates = re.findall(r'[0-9]{2,4}[.|-][0-9]{1,2}[.|-][0-9]{1,2}|~', url) | ||
14 | - | ||
15 | - for i in range(len(dates)): | ||
16 | - dates[i] = dates[i].replace(".", "-") | ||
17 | - | ||
18 | - # 날짜가 없는 경우 | ||
19 | - if len(dates) == 0: | ||
20 | - return "상시" | ||
21 | - | ||
22 | - # XXX ~ | ||
23 | - if dates[-1] == "~": | ||
24 | - dday = dday_calculate(dates[0]) | ||
25 | - if dday > 0: | ||
26 | - return "진행중" | ||
27 | - else: | ||
28 | - return "준비중" | ||
29 | - | ||
30 | - # ~ XXX and XXX ~ XXX | ||
31 | - if dates[-1] != "~": | ||
32 | - dday = dday_calculate(dates[-1]) | ||
33 | - if dday < 0: | ||
34 | - return "D"+str(dday) | ||
35 | - else: | ||
36 | - return "종료" | ||
37 | - | ||
38 | - # except | ||
39 | - return "상 시" | ||
40 | - | ||
41 | - | ||
42 | - | ||
43 | -with open('d.json', 'rt', encoding='utf-8') as json_file: | ||
44 | - json_data = json.load(json_file) | ||
45 | - | ||
46 | - | ||
47 | -for js in json_data: | ||
48 | - for key, value in js.items(): | ||
49 | - if type(value) != str and key != 'View': | ||
50 | - js[key] = str(value) | ||
51 | - if key == "Link" and value[0] == '[': | ||
52 | - js[key] = value[1:-1] | ||
53 | - | ||
54 | - # critical point | ||
55 | - if key == "View": | ||
56 | - js["D_day"] = date_calculate(js["Date"]) | ||
57 | - break | ||
58 | - ############### | ||
59 | - | ||
60 | -with open('result.json', 'w', encoding='utf-8') as make_file: | ||
61 | - make_file.write('[') | ||
62 | - for i, js in enumerate(json_data): | ||
63 | - json.dump(js, make_file, indent="\t", ensure_ascii=False) | ||
64 | - if i != len(json_data) - 1: | ||
65 | - make_file.write(',') | ||
66 | - make_file.write(']') |
view_count_raw.json
deleted
100644 → 0
1 | -{ | ||
2 | - "0": { | ||
3 | - "2019-11-19": 14 | ||
4 | - }, | ||
5 | - "1": { | ||
6 | - "2019-11-19": 3 | ||
7 | - }, | ||
8 | - "2": { | ||
9 | - "2019-11-19": 13 | ||
10 | - }, | ||
11 | - "3": { | ||
12 | - "2019-11-19": 4 | ||
13 | - }, | ||
14 | - "4": { | ||
15 | - "2019-11-19": 3 | ||
16 | - }, | ||
17 | - "5": { | ||
18 | - "2019-11-19": 4 | ||
19 | - }, | ||
20 | - "6": { | ||
21 | - "2019-11-19": 6 | ||
22 | - }, | ||
23 | - "7": { | ||
24 | - "2019-11-19": 3 | ||
25 | - }, | ||
26 | - "8": { | ||
27 | - "2019-11-19": 4 | ||
28 | - }, | ||
29 | - "9": { | ||
30 | - "2019-11-19": 11 | ||
31 | - } | ||
32 | -} | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
view_counter.py
deleted
100644 → 0
1 | -from firebase_admin import db | ||
2 | -from firebase_admin import credentials | ||
3 | -import firebase_admin | ||
4 | -import json | ||
5 | -from datetime import datetime | ||
6 | - | ||
7 | -cred = credentials.Certificate('wello_firebase_SDKKey.json') | ||
8 | -firebase_admin.initialize_app(cred, {'databaseURL': 'https://capstone-vip.firebaseio.com/'}) | ||
9 | -ref = db.reference() | ||
10 | -policies = ref.get() | ||
11 | - | ||
12 | -## compare dict | ||
13 | -json_data = dict() | ||
14 | -today = str(datetime.now().year) + "-" + str(datetime.now().month) + "-" + str(datetime.now().day) | ||
15 | - | ||
16 | -def view_count_raw_writer(): | ||
17 | - with open('./view_count_raw.json', 'w', encoding='utf-8') as make_file: | ||
18 | - json.dump(json_data, make_file, indent="\t") | ||
19 | - | ||
20 | - | ||
21 | -def count_update(): | ||
22 | - for policy in policies: | ||
23 | - if policy["Value"] in json_data.keys(): | ||
24 | - if policy["Value"][datetime.now()] in json_data["Value"].keys(): | ||
25 | - json_data[policy["Value"]][today] = abs(policy["View"]) | ||
26 | - else: | ||
27 | - json_data[policy["Value"]][today] = dict() | ||
28 | - json_data[policy["Value"]][today] = abs(policy["View"]) | ||
29 | - else: | ||
30 | - json_data[policy["Value"]] = dict() | ||
31 | - json_data[policy["Value"]][today] = abs(policy["View"]) | ||
32 | - | ||
33 | - | ||
34 | -def view_count_raw_reader(): | ||
35 | - with open('./view_count_raw.json', 'r', encoding='utf-8') as json_file: | ||
36 | - json_data = json.load(json_file) | ||
37 | - | ||
38 | - | ||
39 | -view_count_raw_reader() | ||
40 | -count_update() | ||
41 | -print(json.dumps(json_data, indent="\t")) | ||
42 | -view_count_raw_writer() |
... | @@ -17,26 +17,6 @@ class AccountSettingActivity : AppCompatActivity() { | ... | @@ -17,26 +17,6 @@ class AccountSettingActivity : AppCompatActivity() { |
17 | val bottomNavigationView: BottomNavigationView = findViewById(R.id.bottomNavigation_account_setting) as BottomNavigationView | 17 | val bottomNavigationView: BottomNavigationView = findViewById(R.id.bottomNavigation_account_setting) as BottomNavigationView |
18 | bottomNavigationView.selectedItemId = R.id.bottomInfo | 18 | bottomNavigationView.selectedItemId = R.id.bottomInfo |
19 | bottomNavigationView.setOnNavigationItemSelectedListener(mOnNavigationItemSelectedListener) | 19 | bottomNavigationView.setOnNavigationItemSelectedListener(mOnNavigationItemSelectedListener) |
20 | - | ||
21 | - /* | ||
22 | - val prof: SharedPreferences = getSharedPreferences("policy_key", Context.MODE_PRIVATE) | ||
23 | - val editor: SharedPreferences.Editor=prof.edit() | ||
24 | - | ||
25 | - input_db.setOnClickListener{ | ||
26 | - editor.putString("0", "[신한금융그룹] 신한 희망사회프로젝트 위기가정 재기지원사업 2년차 사업(2019년 5월~2020년 4월)") | ||
27 | - editor.putString("1", "2020년 동계 아름드리 대학생 해외봉사단원 모집") | ||
28 | - editor.putString("2", "초록우산 어린이재단 인재양성사업 - 2020 아이리더 모집공고") | ||
29 | - editor.putString("3", "(열매나눔복지재단, 처갓집양념치킨)2019 저소득가구 창업지원사업 처갓집양념치킨 창업자 모집공고(5.31-)") | ||
30 | - editor.putString("4", "[2017년도] 예비부부교실 / 신혼부부교실 : 연간일정") | ||
31 | - editor.putString("5", "신생아지원") | ||
32 | - editor.putString("6", "성폭력피해아동청소년 전용쉼터운영지원") | ||
33 | - editor.putString("7", "국가유공자등취업지원") | ||
34 | - editor.putString("8", "결혼이민자 통번역 서비스") | ||
35 | - editor.putString("9", "한부모가족자녀 교육비 지원") | ||
36 | - editor.commit() | ||
37 | - } | ||
38 | - | ||
39 | - */ | ||
40 | } | 20 | } |
41 | private val mOnNavigationItemSelectedListener= | 21 | private val mOnNavigationItemSelectedListener= |
42 | BottomNavigationView.OnNavigationItemSelectedListener{ item-> | 22 | BottomNavigationView.OnNavigationItemSelectedListener{ item-> | ... | ... |
... | @@ -31,25 +31,6 @@ class MainActivity : AppCompatActivity() { | ... | @@ -31,25 +31,6 @@ class MainActivity : AppCompatActivity() { |
31 | super.onCreate(savedInstanceState) | 31 | super.onCreate(savedInstanceState) |
32 | setContentView(R.layout.activity_main) | 32 | setContentView(R.layout.activity_main) |
33 | 33 | ||
34 | - ///// | ||
35 | - val prof: SharedPreferences = getSharedPreferences("policy_key", Context.MODE_PRIVATE) | ||
36 | - val editor: SharedPreferences.Editor=prof.edit() | ||
37 | - | ||
38 | - editor.putString("0", "[신한금융그룹] 신한 희망사회프로젝트 위기가정 재기지원사업 2년차 사업(2019년 5월~2020년 4월)") | ||
39 | - editor.putString("1", "2020년 동계 아름드리 대학생 해외봉사단원 모집") | ||
40 | - editor.putString("2", "초록우산 어린이재단 인재양성사업 - 2020 아이리더 모집공고") | ||
41 | - editor.putString("3", "(열매나눔복지재단, 처갓집양념치킨)2019 저소득가구 창업지원사업 처갓집양념치킨 창업자 모집공고(5.31-)") | ||
42 | - editor.putString("4", "[2017년도] 예비부부교실 / 신혼부부교실 : 연간일정") | ||
43 | - editor.putString("5", "신생아지원") | ||
44 | - editor.putString("6", "성폭력피해아동청소년 전용쉼터운영지원") | ||
45 | - editor.putString("7", "국가유공자등취업지원") | ||
46 | - editor.putString("8", "결혼이민자 통번역 서비스") | ||
47 | - editor.putString("9", "한부모가족자녀 교육비 지원") | ||
48 | - editor.commit() | ||
49 | - | ||
50 | - ///// | ||
51 | - | ||
52 | - | ||
53 | emailSigninBtn.setOnClickListener{ | 34 | emailSigninBtn.setOnClickListener{ |
54 | loginEmail() | 35 | loginEmail() |
55 | } | 36 | } | ... | ... |
... | @@ -55,7 +55,7 @@ class QnAAdapter : RecyclerView.Adapter<QnAAdapter.MainViewHolder>() { | ... | @@ -55,7 +55,7 @@ class QnAAdapter : RecyclerView.Adapter<QnAAdapter.MainViewHolder>() { |
55 | tvTitle.text = item.answer | 55 | tvTitle.text = item.answer |
56 | tvContent.text = item.question | 56 | tvContent.text = item.question |
57 | tvSecond.setOnClickListener{ | 57 | tvSecond.setOnClickListener{ |
58 | - tvTitle.setVisibility(View.GONE) | 58 | + //tvTitle.setVisibility(View.GONE) |
59 | } | 59 | } |
60 | 60 | ||
61 | /* if (item.arrow != "") { | 61 | /* if (item.arrow != "") { | ... | ... |
... | @@ -4,7 +4,6 @@ import android.content.Context | ... | @@ -4,7 +4,6 @@ import android.content.Context |
4 | import android.os.Bundle | 4 | import android.os.Bundle |
5 | import androidx.appcompat.app.AppCompatActivity | 5 | import androidx.appcompat.app.AppCompatActivity |
6 | //import androidx.appcompat.widget.SearchView | 6 | //import androidx.appcompat.widget.SearchView |
7 | -import androidx.core.app.ComponentActivity.ExtraData | ||
8 | import androidx.core.content.ContextCompat.getSystemService | 7 | import androidx.core.content.ContextCompat.getSystemService |
9 | import android.icu.lang.UCharacter.GraphemeClusterBreak.T | 8 | import android.icu.lang.UCharacter.GraphemeClusterBreak.T |
10 | import android.view.View | 9 | import android.view.View |
... | @@ -22,13 +21,19 @@ import com.google.firebase.database.DatabaseError | ... | @@ -22,13 +21,19 @@ import com.google.firebase.database.DatabaseError |
22 | import com.google.firebase.database.DataSnapshot | 21 | import com.google.firebase.database.DataSnapshot |
23 | import com.google.firebase.database.ValueEventListener | 22 | import com.google.firebase.database.ValueEventListener |
24 | import androidx.fragment.app.FragmentActivity | 23 | import androidx.fragment.app.FragmentActivity |
24 | +import androidx.core.app.ComponentActivity.ExtraData | ||
25 | +import androidx.core.content.ContextCompat.getSystemService | ||
26 | +import android.icu.lang.UCharacter.GraphemeClusterBreak.T | ||
27 | + | ||
28 | + | ||
25 | 29 | ||
26 | 30 | ||
27 | data class MemoItem( | 31 | data class MemoItem( |
28 | val Target : String = "", | 32 | val Target : String = "", |
29 | val Policy : String = "", | 33 | val Policy : String = "", |
30 | val Content : String = "", | 34 | val Content : String = "", |
31 | - val Link : String = "" | 35 | + val Link : String = "", |
36 | + val Value : String = "" | ||
32 | ) | 37 | ) |
33 | 38 | ||
34 | var database = FirebaseDatabase.getInstance().reference | 39 | var database = FirebaseDatabase.getInstance().reference |
... | @@ -49,6 +54,26 @@ class SearchActivity : AppCompatActivity() { | ... | @@ -49,6 +54,26 @@ class SearchActivity : AppCompatActivity() { |
49 | //searchView.onActionViewExpanded(); //new Added line | 54 | //searchView.onActionViewExpanded(); //new Added line |
50 | searchView.setIconifiedByDefault(false) | 55 | searchView.setIconifiedByDefault(false) |
51 | 56 | ||
57 | + /// | ||
58 | + | ||
59 | + database.orderByChild("Policy").addListenerForSingleValueEvent(object : ValueEventListener { | ||
60 | + override fun onDataChange(dataSnapshot: DataSnapshot) { | ||
61 | + val size = dataSnapshot.childrenCount | ||
62 | + //Toast.makeText(this@SearchActivity, size.toString(), Toast.LENGTH_SHORT).show() | ||
63 | + if (prof.getString("len", "-1") != size.toString()) { | ||
64 | + //Toast.makeText(this@SearchActivity, "비 효율", Toast.LENGTH_SHORT).show() | ||
65 | + editor.putString("len", size.toString()) | ||
66 | + for (memoSnapshot in dataSnapshot.children) { | ||
67 | + val memo = memoSnapshot.getValue(MemoItem::class.java) | ||
68 | + editor.putString(memo!!.Value, memo!!.Policy) | ||
69 | + } | ||
70 | + editor.commit() | ||
71 | + } | ||
72 | + } | ||
73 | + override fun onCancelled(p0: DatabaseError) { | ||
74 | + } | ||
75 | + }) | ||
76 | + | ||
52 | fun CloseKeyboard() | 77 | fun CloseKeyboard() |
53 | { | 78 | { |
54 | var view = this.currentFocus | 79 | var view = this.currentFocus |
... | @@ -71,9 +96,8 @@ class SearchActivity : AppCompatActivity() { | ... | @@ -71,9 +96,8 @@ class SearchActivity : AppCompatActivity() { |
71 | CloseKeyboard() | 96 | CloseKeyboard() |
72 | 97 | ||
73 | // DB 내 목록에서 맞는거 찾는 부분 | 98 | // DB 내 목록에서 맞는거 찾는 부분 |
74 | - val arr = arrayOf(0,1,2,3,4,5,6,7,8,9) | ||
75 | val key = arrayListOf<String>() | 99 | val key = arrayListOf<String>() |
76 | - for (i in arr) { | 100 | + for (i in 0.. (prof.getString("len", "-1")!!.toInt() -1)) { |
77 | val temp = prof.getString("$i", "fail") | 101 | val temp = prof.getString("$i", "fail") |
78 | val regex = "$query".toRegex() | 102 | val regex = "$query".toRegex() |
79 | val matchResult : MatchResult? = regex.find(temp.toString()) | 103 | val matchResult : MatchResult? = regex.find(temp.toString()) | ... | ... |
... | @@ -78,12 +78,6 @@ | ... | @@ -78,12 +78,6 @@ |
78 | android:text="회원 탈퇴 (준비중)" | 78 | android:text="회원 탈퇴 (준비중)" |
79 | android:textSize="17dp" /> | 79 | android:textSize="17dp" /> |
80 | 80 | ||
81 | - <Button | ||
82 | - android:id="@+id/input_db" | ||
83 | - android:layout_width="match_parent" | ||
84 | - android:layout_height="wrap_content" | ||
85 | - android:text="디비에 넣기" /> | ||
86 | - | ||
87 | </LinearLayout> | 81 | </LinearLayout> |
88 | 82 | ||
89 | <com.google.android.material.bottomnavigation.BottomNavigationView | 83 | <com.google.android.material.bottomnavigation.BottomNavigationView | ... | ... |
... | @@ -24,7 +24,7 @@ | ... | @@ -24,7 +24,7 @@ |
24 | <TextView | 24 | <TextView |
25 | android:id="@+id/questionText" | 25 | android:id="@+id/questionText" |
26 | android:layout_width="wrap_content" | 26 | android:layout_width="wrap_content" |
27 | - android:layout_height="65dp" | 27 | + android:layout_height="50dp" |
28 | android:layout_gravity="center|right" | 28 | android:layout_gravity="center|right" |
29 | android:layout_weight="1" | 29 | android:layout_weight="1" |
30 | android:gravity="center|left" | 30 | android:gravity="center|left" |
... | @@ -47,9 +47,9 @@ | ... | @@ -47,9 +47,9 @@ |
47 | android:layout_width="match_parent" | 47 | android:layout_width="match_parent" |
48 | android:layout_height="wrap_content" | 48 | android:layout_height="wrap_content" |
49 | android:background="#F1F9FF" | 49 | android:background="#F1F9FF" |
50 | + android:lineSpacingExtra="6dp" | ||
50 | android:paddingLeft="11dp" | 51 | android:paddingLeft="11dp" |
51 | android:text="TextView" | 52 | android:text="TextView" |
52 | - android:lineSpacingExtra="6dp" | ||
53 | android:textSize="13dp" /> | 53 | android:textSize="13dp" /> |
54 | 54 | ||
55 | </LinearLayout> | 55 | </LinearLayout> | ... | ... |
vip_key.jks
deleted
100644 → 0
No preview for this file type
-
Please register or login to post a comment