신기성

menu spacing

......@@ -5,17 +5,17 @@ import android.view.View
import android.view.ViewGroup
import android.widget.Toast
import androidx.recyclerview.widget.RecyclerView
import kotlinx.android.synthetic.main.list_item.view.*
import kotlinx.android.synthetic.main.item_policyfield.view.*
class RecyclerAdapter(private val items: ArrayList<YoutubeItem>) :
RecyclerView.Adapter<RecyclerAdapter.ViewHolder>() {
class PolicyFieldAdapter(private val items: ArrayList<PolicyFieldItem>) :
RecyclerView.Adapter<PolicyFieldAdapter.ViewHolder>() {
override fun getItemCount() = items.size
override fun onBindViewHolder(holder: RecyclerAdapter.ViewHolder, position: Int) {
override fun onBindViewHolder(holder: PolicyFieldAdapter.ViewHolder, position: Int) {
val item = items[position]
val listener = View.OnClickListener {it ->
Toast.makeText(it.context, "Clicked: ${item.title}", Toast.LENGTH_SHORT).show()
Toast.makeText(it.context, "Clicked: ${item.policyFieldItemText}", Toast.LENGTH_SHORT).show()
}
holder.apply {
bind(listener, item)
......@@ -24,19 +24,19 @@ class RecyclerAdapter(private val items: ArrayList<YoutubeItem>) :
}
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int):
RecyclerAdapter.ViewHolder {
PolicyFieldAdapter.ViewHolder {
val inflatedView = LayoutInflater.from(parent.context)
.inflate(R.layout.list_item, parent, false)
return RecyclerAdapter.ViewHolder(inflatedView)
.inflate(R.layout.item_policyfield, parent, false)
return PolicyFieldAdapter.ViewHolder(inflatedView)
}
class ViewHolder(v: View) : RecyclerView.ViewHolder(v) {
private var view: View = v
fun bind(listener: View.OnClickListener, item: YoutubeItem) {
view.thumbnail.setImageDrawable(item.image)
view.title.text = item.title
fun bind(listener: View.OnClickListener, item: PolicyFieldItem) {
view.fieldIcon.setImageDrawable(item.policyFieldItemImage)
view.fieldIconText.text = item.policyFieldItemText
view.setOnClickListener(listener)
}
}
......
......@@ -2,6 +2,6 @@ package com.example.vip
import android.graphics.drawable.Drawable
class YoutubeItem(val image: Drawable, val title: String) {
class PolicyFieldItem(val policyFieldItemImage: Drawable, val policyFieldItemText: String) {
}
\ No newline at end of file
......
......@@ -11,21 +11,21 @@ class SignInActivity : AppCompatActivity() {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_signin)
val list = ArrayList<YoutubeItem>()
list.add(YoutubeItem(ContextCompat.getDrawable(this,R.drawable.image01)!!, getString(R.string.title01)))
list.add(YoutubeItem(ContextCompat.getDrawable(this,R.drawable.image02)!!, getString(R.string.title02)))
list.add(YoutubeItem(ContextCompat.getDrawable(this,R.drawable.image03)!!, getString(R.string.title03)))
list.add(YoutubeItem(ContextCompat.getDrawable(this,R.drawable.image04)!!, getString(R.string.title04)))
list.add(YoutubeItem(ContextCompat.getDrawable(this,R.drawable.image05)!!, getString(R.string.title05)))
list.add(YoutubeItem(ContextCompat.getDrawable(this,R.drawable.image06)!!, getString(R.string.title06)))
list.add(YoutubeItem(ContextCompat.getDrawable(this,R.drawable.image07)!!, getString(R.string.title07)))
list.add(YoutubeItem(ContextCompat.getDrawable(this,R.drawable.image08)!!, getString(R.string.title08)))
list.add(YoutubeItem(ContextCompat.getDrawable(this,R.drawable.image09)!!, getString(R.string.title09)))
list.add(YoutubeItem(ContextCompat.getDrawable(this,R.drawable.image10)!!, getString(R.string.title10)))
val adapter = RecyclerAdapter(list)
recyclerView.adapter = adapter
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)))
val adapter = PolicyFieldAdapter(policyFieldList)
policyFieldRecyclerView.adapter = adapter
}
......
......@@ -13,14 +13,31 @@
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="로고 및 검색창" />
<TextView
android:id="@+id/space_rollingBanner"
android:layout_width="match_parent"
android:layout_height="200dp"
android:text="롤링배너창" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recyclerView"
android:id="@+id/policyFieldRecyclerView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clipToPadding="false"
android:layout_height="300dp"
app:layoutManager="androidx.recyclerview.widget.GridLayoutManager"
app:spanCount="3"
tools:listitem="@layout/list_item"/>
tools:listitem="@layout/item_policyfield" />
<TextView
android:id="@+id/space_snackbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="스낵바창" />
</LinearLayout>
......
......@@ -7,7 +7,7 @@
<ImageView
android:id="@+id/thumbnail"
android:id="@+id/fieldIcon"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintLeft_toLeftOf="parent"
......@@ -16,11 +16,11 @@
android:adjustViewBounds="true"/>
<TextView
android:id="@+id/title"
android:id="@+id/fieldIconText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="20sp"
app:layout_constraintTop_toBottomOf="@+id/thumbnail"
app:layout_constraintTop_toBottomOf="@+id/fieldIcon"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"/>
......
<resources>
<string name="app_name">vip</string>
<string name="title01">10 Best Practices for Moving to a Single Activity</string>
<string name="title02">Cost of a Pixel Color (Android Dev Summit 18)</string>
<string name="title03">Foldables, App Bundles and more from Android Dev Summit 18!</string>
<string name="title04">Fun with LiveData (Android Dev Summit 18)</string>
<string name="title05">Keynote (Android Dev Summit 18)</string>
<string name="title06">Modern WebView Best Practices (Android Dev Summit 18)</string>
<string name="title01">교육</string>
<string name="title02">고용</string>
<string name="title03">주거</string>
<string name="title04">건강</string>
<string name="title05">서민금융</string>
<string name="title06">문화</string>
<string name="title07">Performance Analysis Using Systrace (Android Dev Summit 18)</string>
<string name="title08">Preferential Practices for Preferences (Android Dev Summit 18)</string>
<string name="title09">That’s a wrap on Android Dev Summit 2018!</string>
......