soonmyeong2

make main toolbar

...@@ -32,11 +32,15 @@ dependencies { ...@@ -32,11 +32,15 @@ dependencies {
32 implementation 'com.google.firebase:firebase-analytics:17.2.0' 32 implementation 'com.google.firebase:firebase-analytics:17.2.0'
33 implementation 'com.google.firebase:firebase-auth:19.0.0' 33 implementation 'com.google.firebase:firebase-auth:19.0.0'
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'
36 + implementation 'com.android.support:appcompat-v7:23.2.1'
37 + implementation 'com.android.support:design:23.2.1'
38 +
39 +
40 +
35 testImplementation 'junit:junit:4.12' 41 testImplementation 'junit:junit:4.12'
36 androidTestImplementation 'androidx.test:runner:1.2.0' 42 androidTestImplementation 'androidx.test:runner:1.2.0'
37 androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0' 43 androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
38 - implementation 'androidx.recyclerview:recyclerview:1.1.0-beta05'
39 - implementation 'com.google.android.material:material:1.1.0-beta01'
40 } 44 }
41 45
42 apply plugin: 'com.google.gms.google-services' 46 apply plugin: 'com.google.gms.google-services'
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
7 android:label="@string/app_name" 7 android:label="@string/app_name"
8 android:roundIcon="@mipmap/ic_launcher_round" 8 android:roundIcon="@mipmap/ic_launcher_round"
9 android:supportsRtl="true" 9 android:supportsRtl="true"
10 - android:theme="@style/AppTheme"> 10 + android:theme="@style/NoActionBar">
11 <activity android:name=".SignInActivity"></activity> 11 <activity android:name=".SignInActivity"></activity>
12 <activity android:name=".SignUpActivity" /> 12 <activity android:name=".SignUpActivity" />
13 <activity android:name=".MainActivity"/> 13 <activity android:name=".MainActivity"/>
......
1 package com.example.vip 1 package com.example.vip
2 2
3 import android.os.Bundle 3 import android.os.Bundle
4 +import android.view.Menu
5 +import android.view.MenuItem
4 import androidx.appcompat.app.AppCompatActivity 6 import androidx.appcompat.app.AppCompatActivity
5 import androidx.core.content.ContextCompat 7 import androidx.core.content.ContextCompat
6 import androidx.viewpager.widget.ViewPager 8 import androidx.viewpager.widget.ViewPager
9 +import com.google.android.material.snackbar.Snackbar
7 import kotlinx.android.synthetic.main.activity_signin.* 10 import kotlinx.android.synthetic.main.activity_signin.*
8 11
9 class SignInActivity : AppCompatActivity() { 12 class SignInActivity : AppCompatActivity() {
...@@ -15,24 +18,100 @@ class SignInActivity : AppCompatActivity() { ...@@ -15,24 +18,100 @@ class SignInActivity : AppCompatActivity() {
15 18
16 val policyFieldList = ArrayList<PolicyFieldItem>() 19 val policyFieldList = ArrayList<PolicyFieldItem>()
17 20
18 - policyFieldList.add(PolicyFieldItem(ContextCompat.getDrawable(this,R.drawable.image01)!!, getString(R.string.title01))) 21 + policyFieldList.add(
19 - policyFieldList.add(PolicyFieldItem(ContextCompat.getDrawable(this,R.drawable.image02)!!, getString(R.string.title02))) 22 + PolicyFieldItem(
20 - policyFieldList.add(PolicyFieldItem(ContextCompat.getDrawable(this,R.drawable.image03)!!, getString(R.string.title03))) 23 + ContextCompat.getDrawable(this, R.drawable.image01)!!,
21 - policyFieldList.add(PolicyFieldItem(ContextCompat.getDrawable(this,R.drawable.image04)!!, getString(R.string.title04))) 24 + getString(R.string.title01)
22 - policyFieldList.add(PolicyFieldItem(ContextCompat.getDrawable(this,R.drawable.image05)!!, getString(R.string.title05))) 25 + )
23 - policyFieldList.add(PolicyFieldItem(ContextCompat.getDrawable(this,R.drawable.image06)!!, getString(R.string.title06))) 26 + )
24 - policyFieldList.add(PolicyFieldItem(ContextCompat.getDrawable(this,R.drawable.image07)!!, getString(R.string.title07))) 27 + policyFieldList.add(
25 - policyFieldList.add(PolicyFieldItem(ContextCompat.getDrawable(this,R.drawable.image08)!!, getString(R.string.title08))) 28 + PolicyFieldItem(
26 - policyFieldList.add(PolicyFieldItem(ContextCompat.getDrawable(this,R.drawable.image09)!!, getString(R.string.title09))) 29 + ContextCompat.getDrawable(this, R.drawable.image02)!!,
27 - policyFieldList.add(PolicyFieldItem(ContextCompat.getDrawable(this,R.drawable.image10)!!, getString(R.string.title10))) 30 + getString(R.string.title02)
31 + )
32 + )
33 + policyFieldList.add(
34 + PolicyFieldItem(
35 + ContextCompat.getDrawable(this, R.drawable.image03)!!,
36 + getString(R.string.title03)
37 + )
38 + )
39 + policyFieldList.add(
40 + PolicyFieldItem(
41 + ContextCompat.getDrawable(this, R.drawable.image04)!!,
42 + getString(R.string.title04)
43 + )
44 + )
45 + policyFieldList.add(
46 + PolicyFieldItem(
47 + ContextCompat.getDrawable(this, R.drawable.image05)!!,
48 + getString(R.string.title05)
49 + )
50 + )
51 + policyFieldList.add(
52 + PolicyFieldItem(
53 + ContextCompat.getDrawable(this, R.drawable.image06)!!,
54 + getString(R.string.title06)
55 + )
56 + )
57 + policyFieldList.add(
58 + PolicyFieldItem(
59 + ContextCompat.getDrawable(this, R.drawable.image07)!!,
60 + getString(R.string.title07)
61 + )
62 + )
63 + policyFieldList.add(
64 + PolicyFieldItem(
65 + ContextCompat.getDrawable(this, R.drawable.image08)!!,
66 + getString(R.string.title08)
67 + )
68 + )
69 + policyFieldList.add(
70 + PolicyFieldItem(
71 + ContextCompat.getDrawable(this, R.drawable.image09)!!,
72 + getString(R.string.title09)
73 + )
74 + )
75 + policyFieldList.add(
76 + PolicyFieldItem(
77 + ContextCompat.getDrawable(this, R.drawable.image10)!!,
78 + getString(R.string.title10)
79 + )
80 + )
28 81
29 val adapter = PolicyFieldAdapter(policyFieldList) 82 val adapter = PolicyFieldAdapter(policyFieldList)
30 policyFieldRecyclerView.adapter = adapter 83 policyFieldRecyclerView.adapter = adapter
31 84
32 - viewpager=findViewById(R.id.viewpager) as ViewPager 85 + viewpager = findViewById(R.id.viewpager) as ViewPager
33 val viewpageradapter = ViewPagerAdapter(this) 86 val viewpageradapter = ViewPagerAdapter(this)
34 - viewpager.adapter=viewpageradapter 87 + viewpager.adapter = viewpageradapter
35 -} 88 +
89 + // 1. 툴바 사용 설정
90 + setSupportActionBar(toolbar)
91 +
92 + // 2. 툴바 왼쪽 버튼 설정
93 + supportActionBar!!.setDisplayHomeAsUpEnabled(true) // 왼쪽 버튼 사용 여부 true
94 + supportActionBar!!.setHomeAsUpIndicator(R.drawable.return_page) // 왼쪽 버튼 아이콘 설정
95 + supportActionBar!!.setDisplayShowTitleEnabled(false) // 타이틀 안보이게 하기
96 + }
97 + // 3.툴바 메뉴 버튼을 설정
98 + override fun onCreateOptionsMenu(menu: Menu?): Boolean {
99 + menuInflater.inflate(R.menu.main_menu, menu) // main_menu 메뉴를 toolbar 메뉴 버튼으로 설정
100 + return true
101 + }
36 102
103 + // 4.툴바 메뉴 버튼이 클릭 됐을 때 콜백
104 + override fun onOptionsItemSelected(item: MenuItem?): Boolean {
105 + // 클릭된 메뉴 아이템의 아이디 마다 when 구절로 클릭시 동작을 설정한다.
106 + when(item!!.itemId){
107 + android.R.id.home->{ // 메뉴 버튼
108 + Snackbar.make(toolbar,"Menu pressed",Snackbar.LENGTH_SHORT).show()
109 + }
110 + R.id.menu_search->{ // 검색 버튼
111 + Snackbar.make(toolbar,"Search menu pressed",Snackbar.LENGTH_SHORT).show()
112 + }
113 + }
114 + return super.onOptionsItemSelected(item)
115 + }
37 116
38 } 117 }
......
...@@ -6,29 +6,42 @@ ...@@ -6,29 +6,42 @@
6 android:layout_height="match_parent" 6 android:layout_height="match_parent"
7 tools:context=".SignInActivity"> 7 tools:context=".SignInActivity">
8 8
9 +
9 <LinearLayout 10 <LinearLayout
10 - android:layout_width="match_parent" 11 + android:id="@+id/linearLayout"
11 - android:layout_height="match_parent" 12 + android:layout_width="0dp"
13 + android:layout_height="0dp"
12 android:orientation="vertical" 14 android:orientation="vertical"
13 - tools:layout_editor_absoluteX="46dp" 15 + app:layout_constraintBottom_toBottomOf="parent"
14 - tools:layout_editor_absoluteY="287dp"> 16 + app:layout_constraintEnd_toEndOf="parent"
15 - 17 + app:layout_constraintStart_toStartOf="parent"
16 - <TextView 18 + app:layout_constraintTop_toTopOf="parent">
17 - android:id="@+id/space_logo_and_search" 19 +
18 - android:layout_width="match_parent" 20 + <androidx.appcompat.widget.Toolbar
19 - android:layout_height="50dp" 21 + android:id="@+id/toolbar"
20 - android:text="로고 및 검색창" /> 22 + android:layout_width="fill_parent"
23 + android:layout_height="wrap_content"
24 + android:background="#FFF"
25 + android:layout_marginBottom="11dp"
26 + android:elevation="5dp"
27 + android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
28 + app:popupTheme="@style/ThemeOverlay.AppCompat.Dark.ActionBar" >
29 +
30 + <ImageView
31 + android:layout_width="77dp"
32 + android:layout_height="44dp"
33 + android:layout_gravity="center"
34 + android:src="@drawable/toolbar_logo"/>
35 + </androidx.appcompat.widget.Toolbar>
21 36
22 <androidx.viewpager.widget.ViewPager 37 <androidx.viewpager.widget.ViewPager
23 android:id="@+id/viewpager" 38 android:id="@+id/viewpager"
24 - android:layout_width="436dp" 39 + android:layout_width="400dp"
25 android:layout_height="220dp" 40 android:layout_height="220dp"
26 - app:layout_constraintStart_toStartOf="parent" 41 + android:layout_gravity="center"
27 - android:layout_marginStart="8dp"
28 - app:layout_constraintTop_toTopOf="parent"
29 app:layout_constraintEnd_toEndOf="parent" 42 app:layout_constraintEnd_toEndOf="parent"
30 - android:layout_marginEnd="8dp"> 43 + app:layout_constraintStart_toStartOf="parent"
31 - </androidx.viewpager.widget.ViewPager> 44 + app:layout_constraintTop_toTopOf="parent"></androidx.viewpager.widget.ViewPager>
32 45
33 <androidx.recyclerview.widget.RecyclerView 46 <androidx.recyclerview.widget.RecyclerView
34 android:id="@+id/policyFieldRecyclerView" 47 android:id="@+id/policyFieldRecyclerView"
...@@ -39,25 +52,8 @@ ...@@ -39,25 +52,8 @@
39 tools:listitem="@layout/item_policyfield" /> 52 tools:listitem="@layout/item_policyfield" />
40 53
41 54
42 -
43 </LinearLayout> 55 </LinearLayout>
44 56
45 - <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
46 - xmlns:app="http://schemas.android.com/apk/res-auto"
47 - xmlns:tools="http://schemas.android.com/tools"
48 - android:layout_width="match_parent"
49 - android:layout_height="match_parent">
50 -
51 - <com.google.android.material.bottomnavigation.BottomNavigationView
52 - android:layout_gravity="bottom"
53 - app:menu="@menu/bottom_navigation_menu"
54 - android:layout_width="match_parent"
55 - android:layout_height="wrap_content"
56 - app:backgroundTint="@color/design_default_color_background"
57 - app:labelVisibilityMode="labeled"/>
58 - </FrameLayout>
59 -
60 -
61 57
62 </androidx.constraintlayout.widget.ConstraintLayout> 58 </androidx.constraintlayout.widget.ConstraintLayout>
63 59
......
1 -<?xml version="1.0" encoding="utf-8"?>
2 -<menu xmlns:android="http://schemas.android.com/apk/res/android">
3 -
4 - <item android:title="@string/alarm"
5 - android:id="@+id/bottomNavigationAlarmMenuId"
6 - android:icon="@drawable/home"/>
7 -
8 - <item android:title="@string/clock"
9 - android:id="@+id/bottomNavigationClockMenuId"
10 - android:icon="@drawable/instagram"/>
11 -
12 - <item android:title="@string/timer"
13 - android:id="@+id/bottomNavigationTimerMenuId"
14 - android:icon="@drawable/wish"/>
15 -
16 - <item android:title="@string/stopwatch"
17 - android:id="@+id/bottomNavigationStopWatchMenuId"
18 - android:icon="@drawable/info"/>
19 -</menu>
...\ No newline at end of file ...\ No newline at end of file
1 +<?xml version="1.0" encoding="utf-8"?>
2 +<menu xmlns:android="http://schemas.android.com/apk/res/android"
3 + xmlns:app="http://schemas.android.com/apk/res-auto"
4 + >
5 + <item
6 + android:id="@+id/menu_search"
7 + android:title="search"
8 + android:icon="@drawable/search"
9 + app:showAsAction="always"
10 + />
11 +</menu>
...\ No newline at end of file ...\ No newline at end of file
1 <resources> 1 <resources>
2 2
3 <!-- Base application theme. --> 3 <!-- Base application theme. -->
4 - <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar"> 4 + <style name="NoActionBar" parent="Theme.AppCompat.Light.NoActionBar">
5 <!-- Customize your theme here. --> 5 <!-- Customize your theme here. -->
6 <item name="colorPrimary">@color/colorPrimary</item> 6 <item name="colorPrimary">@color/colorPrimary</item>
7 <item name="colorPrimaryDark">@color/colorPrimaryDark</item> 7 <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
......