soonmyeong2

make main toolbar

......@@ -32,11 +32,15 @@ dependencies {
implementation 'com.google.firebase:firebase-analytics:17.2.0'
implementation 'com.google.firebase:firebase-auth:19.0.0'
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:23.2.1'
implementation 'com.android.support:design:23.2.1'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.2.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
implementation 'androidx.recyclerview:recyclerview:1.1.0-beta05'
implementation 'com.google.android.material:material:1.1.0-beta01'
}
apply plugin: 'com.google.gms.google-services'
......
......@@ -7,7 +7,7 @@
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
android:theme="@style/NoActionBar">
<activity android:name=".SignInActivity"></activity>
<activity android:name=".SignUpActivity" />
<activity android:name=".MainActivity"/>
......
package com.example.vip
import android.os.Bundle
import android.view.Menu
import android.view.MenuItem
import androidx.appcompat.app.AppCompatActivity
import androidx.core.content.ContextCompat
import androidx.viewpager.widget.ViewPager
import com.google.android.material.snackbar.Snackbar
import kotlinx.android.synthetic.main.activity_signin.*
class SignInActivity : AppCompatActivity() {
......@@ -15,24 +18,100 @@ class SignInActivity : AppCompatActivity() {
val policyFieldList = ArrayList<PolicyFieldItem>()
policyFieldList.add(PolicyFieldItem(ContextCompat.getDrawable(this,R.drawable.image01)!!, getString(R.string.title01)))
policyFieldList.add(PolicyFieldItem(ContextCompat.getDrawable(this,R.drawable.image02)!!, getString(R.string.title02)))
policyFieldList.add(PolicyFieldItem(ContextCompat.getDrawable(this,R.drawable.image03)!!, getString(R.string.title03)))
policyFieldList.add(PolicyFieldItem(ContextCompat.getDrawable(this,R.drawable.image04)!!, getString(R.string.title04)))
policyFieldList.add(PolicyFieldItem(ContextCompat.getDrawable(this,R.drawable.image05)!!, getString(R.string.title05)))
policyFieldList.add(PolicyFieldItem(ContextCompat.getDrawable(this,R.drawable.image06)!!, getString(R.string.title06)))
policyFieldList.add(PolicyFieldItem(ContextCompat.getDrawable(this,R.drawable.image07)!!, getString(R.string.title07)))
policyFieldList.add(PolicyFieldItem(ContextCompat.getDrawable(this,R.drawable.image08)!!, getString(R.string.title08)))
policyFieldList.add(PolicyFieldItem(ContextCompat.getDrawable(this,R.drawable.image09)!!, getString(R.string.title09)))
policyFieldList.add(PolicyFieldItem(ContextCompat.getDrawable(this,R.drawable.image10)!!, getString(R.string.title10)))
policyFieldList.add(
PolicyFieldItem(
ContextCompat.getDrawable(this, R.drawable.image01)!!,
getString(R.string.title01)
)
)
policyFieldList.add(
PolicyFieldItem(
ContextCompat.getDrawable(this, R.drawable.image02)!!,
getString(R.string.title02)
)
)
policyFieldList.add(
PolicyFieldItem(
ContextCompat.getDrawable(this, R.drawable.image03)!!,
getString(R.string.title03)
)
)
policyFieldList.add(
PolicyFieldItem(
ContextCompat.getDrawable(this, R.drawable.image04)!!,
getString(R.string.title04)
)
)
policyFieldList.add(
PolicyFieldItem(
ContextCompat.getDrawable(this, R.drawable.image05)!!,
getString(R.string.title05)
)
)
policyFieldList.add(
PolicyFieldItem(
ContextCompat.getDrawable(this, R.drawable.image06)!!,
getString(R.string.title06)
)
)
policyFieldList.add(
PolicyFieldItem(
ContextCompat.getDrawable(this, R.drawable.image07)!!,
getString(R.string.title07)
)
)
policyFieldList.add(
PolicyFieldItem(
ContextCompat.getDrawable(this, R.drawable.image08)!!,
getString(R.string.title08)
)
)
policyFieldList.add(
PolicyFieldItem(
ContextCompat.getDrawable(this, R.drawable.image09)!!,
getString(R.string.title09)
)
)
policyFieldList.add(
PolicyFieldItem(
ContextCompat.getDrawable(this, R.drawable.image10)!!,
getString(R.string.title10)
)
)
val adapter = PolicyFieldAdapter(policyFieldList)
policyFieldRecyclerView.adapter = adapter
viewpager=findViewById(R.id.viewpager) as ViewPager
viewpager = findViewById(R.id.viewpager) as ViewPager
val viewpageradapter = ViewPagerAdapter(this)
viewpager.adapter=viewpageradapter
}
viewpager.adapter = viewpageradapter
// 1. 툴바 사용 설정
setSupportActionBar(toolbar)
// 2. 툴바 왼쪽 버튼 설정
supportActionBar!!.setDisplayHomeAsUpEnabled(true) // 왼쪽 버튼 사용 여부 true
supportActionBar!!.setHomeAsUpIndicator(R.drawable.return_page) // 왼쪽 버튼 아이콘 설정
supportActionBar!!.setDisplayShowTitleEnabled(false) // 타이틀 안보이게 하기
}
// 3.툴바 메뉴 버튼을 설정
override fun onCreateOptionsMenu(menu: Menu?): Boolean {
menuInflater.inflate(R.menu.main_menu, menu) // main_menu 메뉴를 toolbar 메뉴 버튼으로 설정
return true
}
// 4.툴바 메뉴 버튼이 클릭 됐을 때 콜백
override fun onOptionsItemSelected(item: MenuItem?): Boolean {
// 클릭된 메뉴 아이템의 아이디 마다 when 구절로 클릭시 동작을 설정한다.
when(item!!.itemId){
android.R.id.home->{ // 메뉴 버튼
Snackbar.make(toolbar,"Menu pressed",Snackbar.LENGTH_SHORT).show()
}
R.id.menu_search->{ // 검색 버튼
Snackbar.make(toolbar,"Search menu pressed",Snackbar.LENGTH_SHORT).show()
}
}
return super.onOptionsItemSelected(item)
}
}
......
......@@ -6,29 +6,42 @@
android:layout_height="match_parent"
tools:context=".SignInActivity">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/linearLayout"
android:layout_width="0dp"
android:layout_height="0dp"
android:orientation="vertical"
tools:layout_editor_absoluteX="46dp"
tools:layout_editor_absoluteY="287dp">
<TextView
android:id="@+id/space_logo_and_search"
android:layout_width="match_parent"
android:layout_height="50dp"
android:text="로고 및 검색창" />
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#FFF"
android:layout_marginBottom="11dp"
android:elevation="5dp"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
app:popupTheme="@style/ThemeOverlay.AppCompat.Dark.ActionBar" >
<ImageView
android:layout_width="77dp"
android:layout_height="44dp"
android:layout_gravity="center"
android:src="@drawable/toolbar_logo"/>
</androidx.appcompat.widget.Toolbar>
<androidx.viewpager.widget.ViewPager
android:id="@+id/viewpager"
android:layout_width="436dp"
android:layout_width="400dp"
android:layout_height="220dp"
app:layout_constraintStart_toStartOf="parent"
android:layout_marginStart="8dp"
app:layout_constraintTop_toTopOf="parent"
android:layout_gravity="center"
app:layout_constraintEnd_toEndOf="parent"
android:layout_marginEnd="8dp">
</androidx.viewpager.widget.ViewPager>
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"></androidx.viewpager.widget.ViewPager>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/policyFieldRecyclerView"
......@@ -39,25 +52,8 @@
tools:listitem="@layout/item_policyfield" />
</LinearLayout>
<FrameLayout 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:layout_width="match_parent"
android:layout_height="match_parent">
<com.google.android.material.bottomnavigation.BottomNavigationView
android:layout_gravity="bottom"
app:menu="@menu/bottom_navigation_menu"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:backgroundTint="@color/design_default_color_background"
app:labelVisibilityMode="labeled"/>
</FrameLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
......
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item android:title="@string/alarm"
android:id="@+id/bottomNavigationAlarmMenuId"
android:icon="@drawable/home"/>
<item android:title="@string/clock"
android:id="@+id/bottomNavigationClockMenuId"
android:icon="@drawable/instagram"/>
<item android:title="@string/timer"
android:id="@+id/bottomNavigationTimerMenuId"
android:icon="@drawable/wish"/>
<item android:title="@string/stopwatch"
android:id="@+id/bottomNavigationStopWatchMenuId"
android:icon="@drawable/info"/>
</menu>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
>
<item
android:id="@+id/menu_search"
android:title="search"
android:icon="@drawable/search"
app:showAsAction="always"
/>
</menu>
\ No newline at end of file
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<style name="NoActionBar" parent="Theme.AppCompat.Light.NoActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
......